Q:

update query in mongoose

// This will create another document if it doesn't exist
findByIdAndUpdate(_id, { something: 'updated' }, { upsert: true });
1
User.update({"created": false}, {"$set":{"created": true}}, {"multi": true}, (err, writeResult) => {});
0
var conditions = { name: 'bourne' } 
  , update = { $inc: { visits: 1 }}

Model.update(conditions, update, { multi: true }).then(updatedRows=>{
  
}).catch(err=>{
  console.log(err)
  
})
0

New to Communities?

Join the community