mongo-changestream-connector

1.3.1 • Public • Published

Mongo Changestream Connector

Description

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 Connector constructor.

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 modelName.

Convenience variables:

When using Mongoose

connector.models

When using MongoDB

MongoClient connector.mongoClient = client

Db Instance the return value of mongoClient.db() connector.db

How to contribute

Release

  • Run npm run release-test to 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.
  • Run npm run release to finally publish the module on NPM.

How to test

Run all the tests once with coverage:

npm test

Run all the tests without coverage and with a watch:

npm tests

Run the MongoDB tests without coverage and with a watch:

npm test-mongo

Run the Mongoose tests without coverage and with a watch:

npm test-mongoose

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.1
    0
    • latest

Version History

Package Sidebar

Install

npm i mongo-changestream-connector

Weekly Downloads

0

Version

1.3.1

License

MIT

Unpacked Size

12.8 kB

Total Files

5

Last publish

Collaborators

  • midnightp