What happens when you increment a field that does not exist (upsert case) ?...
db.collection.findAndModify({query:{id:"id_in_param"},
update:{$inc:{score:1}},
upsert:true
})
The document said:
If the field does not exist, $inc creates the field and sets the field to the specified value.
In your case, new field score: 1
is added
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With