A NoSQL (and MongoDB compliant) Query Engine coded in CoffeeScript for Server-Side use with Node.js and Client-Side use with Web-Browsers
Query-Engine supports the exact same queries as MongoDb. Find the full listing of supported queries here.
You can find the test suite which showcases how to use the supported queries here.
You can try it out in real-time on the client side with a web browser here.
-
Server-Side with Node.js and CoffeeScript
-
Install
npm install query-engine
-
Require
queryEngine = require 'query-engine'
-
Client-Side with Web Browsers
-
Download Query-Engine and upload it to your webserver
-
Include
lib/query-engine.js
inside your page<script src="path/to/query-engine/lib/query-engine.js"></script>
-
Utilise the
window.queryEngine
namespace
-
-
Server-Side with Node.js and CoffeeScript
# Collection documents = new queryEngine.Collection 0: title: 'abc' tags: ['a','b'] 1: title: 'blah' tags: ['a','b','c'] # Query documents.find tags: $in: ['a'] # {0: documents.0, 1: documents.1} documents.find title: 'blah' # {1: documents.1}
-
Client-Side with Web Browsers and JavaScript
//Collection var documents = new window.queryEngine.Collection({ 0: { title: 'abc', tags: ['a', 'b'] }, 1: { title: 'blah', tags: ['a', 'b', 'c'] } }); // Query documents.find({ tags: { $in: ['a'] } }); // {0: documents.0, 1: documents.1} documents.find({ title: 'blah' }); // {1: documents.1}
-
You can also extend the native object prototype so queryEngine will work for all objects (not just collections) by doing:
queryEngine.extendNatives()
-
v0.5.0 August 13, 2011
- Added client side demo
- Added
queryEngine.Collection
class so it doesn't extend the object prototype by default- If you would like to still extend the object prototype you can call
queryEngine.extendNatives()
- If you would like to still extend the object prototype you can call
-
v0.4.0 August 13, 2011
- Find will now return a ID associated object always
- Before it was only doing it when the object we were finding was an ID associated object
- Now supports
$and
,$or
and$nor
, as well as$type
- Find will now return a ID associated object always
-
v0.3.0 August 11, 2011
- Now supports models as well as native javascript objects
- This was done by checking if the record has a
get
function, if it does then we use that instead of directly accessing the field from the object
- This was done by checking if the record has a
- Now supports models as well as native javascript objects
-
v0.2 July 6, 2011
- Added toArray, sort, findOne, remove, forEach
-
v0.1 July 6, 2011
- Initial commit
Licensed under the MIT License Copyright 2011 Benjamin Arthur Lupton