Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-fire

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-fire

turn mongoose into firebase with one plugin

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

mongoose-fire

Make any model emit events on create, update, and delete.

Install

npm install mongoose-fire

Then attach it to each model that you want to be an event emitter

const mongoose-fire = require('mongoose-fire'); 
exampleSchema.plugin(mongoose-fire);

And you're done!

Events

Once these plugins are installed, you can then access the following events

Model.on('create')

Modle.on('update')

Model.on('update:<attr>')

Modle.on('remove')

Notice about Middleware hooks

Events won't be fired when findByIdAndUpdate and other similar aggregate methods are used To get an event to fire, you'll have to manually edit the document and manually call the save() method. This is because of the way Mongoose handles findByIdAndUpdate behind the scenes with the MongoDB driver.

Keywords

FAQs

Package last updated on 30 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc