mongo-to-knex
v0.5.0
Published
mongo-to-knex
Downloads
89
Readme
mongo to knex
Applies mongo standard query to knex query builder.
Available operators
Checkout the available operators in the tests.
Installation
Install via npm:
$ npm install mongo-to-knex
Usage
var mongoToKnex = require('mongo-to-knex');
// knex main object
var knex = require('knex')({ /* knex config */ });
// knex query builder object
var knexQuery = knex('your-table-name');
// your query on mongo standard
var mongoQuery = { age: { $lt: 10 } };
// applies mongo query to knex builder
mongoToKnex(mongoQuery, knexQuery);
// continue using the knex query normally
return knexQuery.
.limit(100)
.orderBy('name', 'desc');
Contributing
It is required to use editorconfig and please write and run specs before pushing any changes:
npm test
License
Copyright (c) 2015 Max Claus Nunes. This software is licensed under the MIT License.