Package Exports
- @aggregion/mongo-like-query-to-sql
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@aggregion/mongo-like-query-to-sql) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mongo-like-query-to-sql
A tool to convert a mongo-like query to SQL string
Installation
npm i -s @aggregion/mongo-like-query-to-sql
Usage
import {objToSQL} from '@aggregion/mongo-like-query-to-sql';
console.log(objToSQL({
$and: [{
$or: [
{age: {$hasAny: [35, 40]}},
{age: {$gte: 20, $lte: 30}},
],
}, {
'settle.population': {$gte: 10000, $lte: 50000},
}],
}));
// Outputs: '(((((hasAny(age, [35, 40]))) OR ((age >= 20 AND age <= 30)))) AND ((settle.population >= 10000 AND settle.population <= 50000)))'