ObjectID() is currently only supported as part of MongoDB shell. This support comes with significant limitations, such as a requirement to submit data as a 24 HEX character string.

If data is not submitted as a 24 HEX character string , it is not inserted. The same data is  inserted into _id field of ObjectID data type as a string with Robomongo.


ObjectID in Mongo DB is special data type. Field _id is a default field generated for each document in a collection. That field by default has ObjectID data type. If value of the field is not provided when inserting the document, the value is generated by MongoDB. If the value is provided in the form of a literal, it must be presented in the form of ObjectId("5be451f72c25bcea60240daa"), where the string in double quotes contains HEX digits 24 character long. DataDirect driver implicitly converts data provided in INSERT statement for _id field to the form of ObjectId("value") if the value provided is 24 character HEX string.

However, MongoDB allows to provide values for field _id of other than ObjectID data type(text string for example). Even more, there can be mixed data types in that field in the same collection. From that moment ,any value provided in INSERT statement will be written as a string value even if it represents string of 24 HEX characters.