Answers for "node js mongodb update nested object"

2

node js mongodb update nested object

//just read documentaion in source and see how to  use the $ sign !! 
myDataBase.updateOne({ 'project': 'test2', 'issues._id': new ObjectID('61006f2409a2524514d877ce') }, { $set: { 'issues.$.open': true, 'issues.$.updated_on': new Date() } })
//for  mongodb 4+ 
const ObjectId = require('mongodb').ObjectId;
Posted by: Guest on July-29-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language