qwebs-mongo
Mongo service for Qwebs server.
Features
return $mongodb;
Add the mongo connection string in config.json
Declare and inject $mongo service
Via route.json
{ "services": [ { "name": "$mongo", "location": "qwebs-mongo" } ]}
Or in javascript
const Qwebs = ;const qwebs = ;qwebs;
Use $mongo service
Hight level api
const CRUD = ; { super"collectionName" $mongo; }; /* manage skip and limit as querystring */ { requestmongo = //define mongo query, options,... options: limit: skip: return super; }
Low level api
/* no extend -> custom implementation */ { this$mongo = $mongo; }; { return this$mongodb; );};
Installation
$ npm install qwebs-mongo
Test
To run our tests, clone the qwebs-mongo repo and install the dependencies.
$ git clone https://github.com/BenoitClaveau/qwebs-mongo --depth 1$ cd qwebs-mongo$ npm install$ mongod --dbpath ./data/db$ node.exe "../node_modules/mocha/bin/mocha" tests