Skip to content

Mongoose plugins to lock a document until you have finish with it

Notifications You must be signed in to change notification settings

lchenay/mongoose-document-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
        })
    })
}```

About

Mongoose plugins to lock a document until you have finish with it

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published