mongoid/mongoid — Issue #1488: Info: How _id and $oid are used by MongoID in “embedded one to many” modelling?
Author: lgs
Created: 2011-12-09 13:46:13+00:00
State: open

Having an embedded one 'user' to many 'watchlists' docs, the ODM automatically create an _id "4ebab31298faeb0001000602" for the user and many progressive $oid "4edfa2f5610b5f0001000001", $oid "4edfa2f5610b5f0001000002", $oid "4edfa2f5610b5f000100000n" ... for the embedded documents.

What happen to $oid embedded documents identifiers, when I user.watchlists.clear and user.watchlists.create the embedded doc ? Are they manteined as before or changed in some way ?

More in general, how embedded ids are working and where can I have a deeper understand (api/docs/tutorials ?) of the algorithm used to assign embedded docs $oid ?