Knect Mongo
Mongodb connection and model helper.
Usage
Below example utilizes async/await you can also use promises or callbacks if you wish, all supported.
$ npm install knect-mongo s-
OR
$ yarn add knect-mongo
After install import or require knect-mongo.
; /** * Create singleton instance. */; ;
WORKING WITH DATA
You can find all static methods for a model in the source document.ts file.
FINDING DATA
Additional boilerplate from above left out for clarity.
In the above example we create the model but what if a model already exists? It's important to note if using Typescript we need to pass back in the schema for the model. This is because we cannot store the design time type in our map. Simply pass in our defined schema as show above then import and reuse it here.
// file containing all our defined schemas NOT SHOWN ABOVE.// this is NOT required if NOT using Typescript.;
Docs
See https://blujedis.github.io/knect-mongo/
Change
See CHANGE.md
License
See LICENSE.md