mongodb - Is BinData a Mongo ObjectId? -


my team on mongodb 2.4.10. id fields this

{ "_id" : bindata(3,"fektlzkzw8m4jjx5nb+fkw==") 

i know 3 bson subtype , value base64. objectid or not? i'm being told it's not. need objectid gettimestamp() method.

what see uuid legacy encoding.

bindata(3, ...), however, has nothing bson types referenced in answer , pointed out. of course bson type 0x05, since it's binary data. shows bindata on console.

however, bindata has, again, 'internal type', speak, subtype. 3 you're seeing first parameter bindata constructor. can see from spec, subtype 3 specifies uuid.

\x03 uuid (old) - used uuid subtype, deprecated in favor of \x04. drivers , tools languages native uuid type should handle \x03 appropriately.

that means not binary data, unfortunately, uuids (all?) don't contain timestamp, information lost i'm afraid.

note objectid has different bson type (0x07), way bit more efficient bindata, because no additional subtype information needs stored. differently put, bindata never objectid (unless explicitly stored generic binary information, counterproductive)


Comments