We used to have _id field as type Document/DBObject/HashMap, such as:
----------------------------------------------------------------------------------
{ "_id" : { "c" : 1, "p" : 897564, "r" : "T", "o" : [ "C" ] } }
However, we have migrated to mongodb 3.4.4 recently, and I can no longer insert Document with compounded _id field in java. It has created a new _id field, and changed my _id.
------------------------------------------------------------------------------------
This is the document I tried to insert: {"_id":{"c":1,"p":1}}
This is what I got in mongo: { "_id" : ObjectId("59725af7e93d34a706522d6e"), "c" : 1, "p" : 1 }
However, I can still insert the document with correct _id in mongo shell:
-----------------------------------------------------------------------
> db.xxx_1.insert({"_id":{"c":1,"p":1}})
WriteResult({ "nInserted" : 1 })
> db.xxx_1.find()
{ "_id" : { "c" : 1, "p" : 1 } }
Do I need special setup?
Thanks for your help in advance!