0.1.0 • Published 9 years ago

uniql-mongodb v0.1.0

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

UniQL-MongoDB

This generates MongoDB queries based on UniQL ASTs.

Example

var parse = require( 'uniql' );
var mongoCompile = require( 'uniql-mongodb' );

var ast = parse( '( height <= 20 or ( favorites.color == "green" and height != 25 ) ) and firstname ~= "o.+"' );
var mongoQuery = mongoCompile( ast );
console.log( util.inspect( mongoQuery, { depth: null } ) );

Resulting query:

{ '$or': 
   [ { height: { '$lte': 20 } },
     { 'favorites.color': 'green', height: { '$ne': 25 } } ],
  firstname: { '$regex': 'o.+' } }

License

MIT

0.1.0

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago