-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Documentation
-
None
-
Not Needed
For performance reasons, the server recommends that the _id field in any inserted Document be the first one. transformAndEnsureID() used to move the _id field of any document to be first, but as of GODRIVER-1180, it no longer does.
We'd like to avoid changing the order of a Document that the user has created, but we should document that putting _id in any position but the first in an ordered Document insertion can potentially cause a loss in performance.
Additionally, we should document that if users do not specify an _id in a bson.D, one will be added for them and added first. Finally, we should mention that there's no way to guarantee the position of a manually-added _id field in a bson.M.