Hello,
I am not able use update pipeline with findOneAndUpdate and need help with the same.
db.getCollection('test').findOneAndUpdate({ lastAssignedTime: {$lt: new Date((new Date())-1000*10)} },
[
{
$set:
{
priority:
{
"$cond":
{
if: {$gte: ["$vmAssignedSessions", 3]},
then: 99,
else: 1,
}
}
}
}
],
{sort: { "priority" : 1 }}
)
I keep running into
021-03-03T17:24:11.474-0800 E QUERY [js] Error: the update operation document must contain atomic operators :
DBCollection.prototype.findOneAndUpdate@src/mongo/shell/crud_api.js:819:1
Mongo component versions:
MongoDB shell version v4.0.0
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 4.2.12
Thanks in advance!