0.0.2 • Published 9 years ago

mongo-rql v0.0.2

Weekly downloads
39
License
BSD
Repository
github
Last release
9 years ago

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