mongoose-document-lock

0.0.1 • Public • Published

mongoose-document-lock

This plugin provides a locking feature on each document that can be used on non-thread safe part of your nodejs application.

It do not lock save for other thread. It's not intended for that but to lock some portion of code like:

schema.methods.doSomeStuffThatIsNotThreadSafe(cb) {
    var self = this
 
    self.getLock(function(err) {
        if (err) {
        // We was unable to get the lock
            return cb(err);
        }
 
        self.doMyStuff(function() {
            self.releaseLock(cb)
        })
    })
}```

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    1

Package Sidebar

Install

npm i mongoose-document-lock

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • lchenay