Mongo Changestream Connector
Connect and change streams with Mongoose
This module is created for Mongo Live Server
How to install
This module depends on mongodb. If you're using Mongoose, and you want to create Mongoose connections instead of native MongoDB connections, e.g. to instantiate your Mongoose models with, mongoose@5 is a peer dependency of this module. So, make sure that Mongoose version 5 is installed in your project.
npm i mongo-changestream-connector
Or when using yarn:
yarn add mongo-changestream-connector
How to use
Supply the setting
useMongoose: true to the
Now, after using the mongoose connection to instantiate models, you can access all mongoose models with
Connector.models. The reference to the native MongoDB with
Connector.db will now not be available anymore.
Finally, instead of specifying
collectionName in the
changeStream method, specify
When using Mongoose
When using MongoDB
MongoClient connector.mongoClient = client
Db Instance the return value of
How to contribute
npm run release-testto make sure that everything is ready and correct for publication on NPM.
- If the previous step succeeded, release a new master version with a raised version tag following the git flow standard.
npm run releaseto finally publish the module on NPM.
How to test
Run all the tests once with coverage:
Run all the tests without coverage and with a watch:
Run the MongoDB tests without coverage and with a watch:
Run the Mongoose tests without coverage and with a watch: