I have a field on my collections that needs the information of _id. The problem is that _id is auto generated on server so I can’t populate this field before saving it first. Is there a way to achieve this without making 2 calls to the server? (1 for saving and then 1 for update)
Just to make a simple analogy, in an sql env, I would create a trigger afterInsert and then populate this field.
in a single instance, if I use new ObjectId() (without parameters), the driver will guarantee uniqueness?
how about in a distributed systems environment? if N systems are doing the same, the chances of collision will increase considerably, right?
I have been reading and considering that process and machine ids are used in the composition of objectId, it shouldn’t cause collisions. Therefore, calling new ObjectId() should be enough for my problem.