Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to listen changes when creating record using new and save method #1

Open
lavkesh1608 opened this issue Mar 28, 2017 · 0 comments
Open

Comments

@lavkesh1608
Copy link

lavkesh1608 commented Mar 28, 2017

var user = new User(data);

user.save(function(err){

})

Is this like work ?

 var mongooseObserver = require('mongoose-observer')
  
  mongooseObserver.register('User', 'save', function(createdUser){
    // this callback will be executed when a new user is created
    // Do something here, for example, send a email to the created user
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant