MongoDB Documentation, Release 3.0.4 BSON documents may have more than one field with the same name. Most MongoDB interfaces , however, represent MongoDB with a structure (e.g. a hash table) that does not support duplicate field names. If you need to manipulate documents that have more than one field with the same name, see the driver documentation for your driver. Some documents created by internal MongoDB processes may have duplicate fields, but no MongoDB process will ever add duplicate fields to an existing user document. For indexed collections (page 481), the values for the indexed fields have a Maximum Index Key Length limit. See Maximum Index Key Length for details. Documents have the following attributes: The maximum BSON document size is 16 megabytes. The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth. To store documents larger than the maximum size, MongoDB provides the GridFS API. See mongofiles and the documentation for your driver for more information about GridFS. MongoDB preserves the order of the document fields following write operations except for the following cases: Changed in version 2.6: Starting in version 2.6, MongoDB actively attempts to preserve the field order in a document. Before version 2.6, MongoDB did not actively preserve the order of the fields in a document. The _id field has the following behavior and constraints: The following are common options for storing values for _id : Chapter 4. Data Models 170 • Use an ObjectId (page 176). • Use a natural unique identifier, if available. This saves space and avoids an additional index. • By default, MongoDB creates a unique index on the _id field during the creation of a collection. • The _id field is always the first field in the documents. If the server receives a document that does not have the _id field first, then the server will move the field to the beginning. • The _id field may contain values of any BSON data type (page 178), other than an array. Warning: To ensure functioning replication, do not store values that are of the BSON regular expression type in the _id field. The _id Field Document Field Order Document Size Limit Document Limitations Field Value Limit • The _id field is always the first field in the document. • Updates that include renaming of field names may result in the reordering of fields in the document.