I am going through a course on MongoDB. Below is my list of documents in a collection called 'flightData'. Below is result of find query:
flights> db.flightData.find()
[
{
_id: ObjectId("611aaa1c4a0269583c8d81b0"),
aircraft: 'AirBus A308',
departingFrom: 'Mumbai',
arrivalStation: 'Moscow',
departureDate: '24/09/2021',
departureTime: '01:44',
arrivingAt: '12:00',
isOneWay: false,
status: {
description: 'on time',
lastUpdated: 'One hour ago',
details: { contact: 'John Doe' }
}
},
{
_id: ObjectId("611aaa554a0269583c8d81b1"),
aircraft: 'AirBus A308',
departingFrom: 'Kolkata',
arrivalStation: 'Stockholm',
departureDate: '24/09/2021',
departureTime: '01:44',
arrivingAt: '12:00',
isOneWay: false,
status: {
description: 'on time',
lastUpdated: 'One hour ago',
details: { contact: 'Cool User' }
}
}
]
When they show the difference between update and updateMany through an example similar to below one:
flights> db.flightData.update({_id:ObjectId("611aaa554a0269583c8d81b1")},{"delayed":false})
In the lecture it works. However, in my case it throws below error:
MongoInvalidArgumentError: Update document requires atomic operators
Can someone please explain this behavior? Is it not supported for my version or something else?
I am using MongoDB 5.0.2, mongosh 1.0.5