Sails.js & Waterline ORM unset key MongoDB -


what method used unset key in mongodb waterline orm?

consider following document:

{     name : 'brian',     age : 29 } 

getting user no problem:

var users = users.findone({ name : 'brian' }).exec(cb); 

i age go away. i've tried following accomplish this:

user.age = undefined; user.save();  user.age = null; user.save();  delete user.age; user.save(); 

none seem work. #1 sets null, #2 sets null, #3 leaves original value.

thanks.

waterline orm meant support wide range of datastores, doesn't support methods particular mongodb. can access underlying mongodb driver using .native() method, want (see mongodb node driver docs available methods):

user.native(function(err, collection) {      collection.findandmodify(         {name: 'brian'},          {$unset: {age: true}},          function (err, object) {            // continue...         }     ); ) 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -