Reputation: 1875
Can we use {upsert: true} for mongoDB update aggregation pipeline? Any examples would be very appreciated.
Upvotes: 1
Views: 432
Reputation: 3349
Yes, of course, it will work.
db.getCollection('tmp5').update({
"someKey":"nonExisting"
}, [
{
"$set": {
"name": "ValToUpdate"
}
}
], {
upsert: true
})
Upvotes: 1