db.flightData.update({_id:ObjectId(“6707bfffaa65c296d5d7b628”)},{delayed:true})
I am new to MongoDB. I am executing the above command which should ideally replace all the existing content in the document with the new one, but it is throwing the following error :
Update document requires atomic operators
Azri
(Azri Azmi)
October 12, 2024, 4:29pm
2
Hi @ankit_tyagi ,
Welcome to the forum!
Seems like you did not specify an operator. Can you try this?
db.flightData.update( { _id: ObjectId("6707bfffaa65c296d5d7b628") }, { $set: { delayed: true } } )
Here is a reference for Update operators: https://www.mongodb.com/docs/manual/reference/operator/update/
Try this (added $set operator)
db.flightData.update({_id:ObjectId(“6707bfffaa65c296d5d7b628”)},{$set: {delayed:true}})
1 Like