Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mongo-rql

neonstalwart44BSD0.0.2

translate RQL queries into mongodb query objects

persevere, rql, mongodb, query

readme

mongo-rql

Convert RQL into MongoDB queries

Build Status

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