Skip to content

monk-middlewares/monk-middleware-wrap-non-dollar-update

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

monk-middleware-wrap-non-dollar-update

A monk middleware to wrap the update not in $ with $set

npm install --save monk-middleware-wrap-non-dollar-update

Usage

db.addMiddleware(require('monk-middleware-wrap-non-dollar-update'))

// this would usually replace the document
db.users.update({_id: 'userId'}, {
  username: 'foo'
})

// but with the middleware, it's equivalent to
db.users.update({_id: 'userId'}, {
  $set: {
    username: 'foo'
  }
})
// which only update the username field

License

MIT

About

A monk middleware to wrap the update not in $ with $set

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published