Skip to content

maxcnunes/mongo-to-knex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Applies a query like mongo standards to knex query builder

Resources

License

Stars

Watchers

Forks

Packages

No packages published