I am using com.mongodb.util.JSON.parse
to parse a JSON file to DBObject. How do I specify dates, refs, and objects IDs in the JSON file?
Dates : { myDate: {$date: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" } }
// Date in the mentioned ISODate string format.
Refs : { myRef : { $ref : <collname>, $id : <idvalue>[, $db : <dbname>] } }
// collname is collection name, idvalue is the _id of the referred document and optionally dbname is the database the document is in.
ObjectIds : { _id : {$oid: "4e942f36de3eda51d5a7436c"} }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With