mongo-rql

0.0.2 • Public • Published

mongo-rql

Convert RQL into MongoDB queries

BuildStatus

Example

var mongoRql = require('mongo-rql'),
    Query = require('rql/query').Query,
    color = 'yellow',
    query = new Query().eq('color', color).sort('-size', 'price'),
    mongoQuery = mongoRql(query),
    cursor = db.collection.find(mongoQuery.criteria, {
        skip: mongoQuery.skip,
        limit: mongoQuery.limit,
        fields: mongoQuery.projection,
        sort: mongoQuery.sort
    });
 
    cursor.toArray(function (err, docs) {
        // ...
    });

Install

With npm do:

npm install mongo-query

License

New BSD License. All code is developed under the terms of the Dojo Foundation CLA.

© 2014 Ben Hockey

Package Sidebar

Install

npm i mongo-rql

Weekly Downloads

15

Version

0.0.2

License

BSD

Last publish

Collaborators

  • neonstalwart