Question: USING MONGODB I need to use the db.collection.updateMany() method on the inventory collection to update all documents where qty is less than 50. My code

USING MONGODB

I need to use the db.collection.updateMany() method on the inventory collection to update all documents where qty is less than 50.

My code is:

db.inventory.updateMany({ "qty": { $lt: 50 } },{$set: { "size.uom": "in", status: "P" }, "currentDate": { "lastModified": true }})

however, I keep getting this error:

MongoServerError: Unknown modifier: currentDate. Expected a valid update modifier or pipeline-style update specified as an array

Please help :)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!