Mongo UUID Type 03 instead of 04 from mongo shell

Viewed 4389

MongoDB UUID conversion from Mongo Shell turns out be TYPE 03, legacy format. How do we get it to work with TYPE 04, binary format?

> db.foo.insert({"_id":1000,"key1":UUID("240003A09CEC456AB57B98FF8E0E45DB")})
  WriteResult({ "nInserted" : 1 })
> db.foo.find({_id:1000})
  { "_id" : 1000, "key1" : BinData(3,"JAADoJzsRWq1e5j/jg5F2w==") }
> db.version()
  3.4.2

From Java code we are able to use bytebuffers and insert as type 04 binary uuid, sample : BinData(4,"XWCwWqIVTfiEkTx9Yl+2UQ==").

1 Answers
Related