When we increment the value of the property, which not exists, mongo sets its initial value to zero and then performs the incrementation. Is it possible to define this `initial value`?
My use case: There are dynamic properties, which can't be preinitialised/created on the first insert, but they all have the default start value: 100. So I would like to get this:
{ $inc: { "en.points" : 5 } }
to insert (if not exists): 105.
I would also like to eliminate additional requests to the DB, to check if any value for the property exists.
Would anybody have some thoughts on this?
Thanks in advance,
Alex