MongoDB Documentation, Release 3.0.4 An MD5 hash returned by the filemd5 command. This value has the String type. Optional. A human-readable name for the document. Optional. A valid MIME type for the document. Optional. An array of alias strings. Optional. Any additional information you want to store. files. md5 files. filename files. contentType files. aliases files. metadata • a 4-byte value representing the seconds since the Unix epoch, • a 3-byte machine identifier, • a 2-byte process id, and • a 3-byte counter, starting with a random value. 4.4.4 ObjectId Overview ObjectId is a 12-byte BSON type, constructed using: In MongoDB, documents stored in a collection require a unique _id field that acts as a primary key . MongoDB uses ObjectIds as the default value for the _id field if the _id field is not specified; i.e. if a document does not contain a top-level _id field, the MongoDB driver adds the _id field that holds an ObjectId. In addition, if the mongod receives a document to insert that does not contain an _id field, mongod will add the _id field that holds an ObjectId. MongoDB clients should add an _id field with a unique ObjectId. Using ObjectIds for the _id field provides the following additional benefits: Important: The relationship between the order of ObjectId values and generation time is not strict within a single second. If multiple systems, or multiple processes or threads on a single system generate values, within a single second; ObjectId values do not represent a strict insertion order. Clock skew between clients can also result in non-strict ordering even for values because client drivers generate ObjectId values. Also consider the Documents (page 168) section for related information on MongoDB’s document orientation. The mongo shell provides the ObjectId() wrapper class to generate a new ObjectId, and to provide the following helper attribute and methods: The hexadecimal string representation of the object. • str • in the mongo shell, you can access the creation time of the ObjectId , using the getTimestamp() method. • sorting on an _id field that stores ObjectId values is roughly equivalent to sorting by creation time. ObjectId() Chapter 4. Data Models 176