BlackLabs / play-morphia

Provide mongodb access service to play.db.Model via Morphia
Apache License 2.0
130 stars 51 forks source link

ObjectId Representation #123

Open ThisThatBC opened 10 years ago

ThisThatBC commented 10 years ago

Hi,

I need to convert the ObjectId data type to a string in Javascript. I found a Javascript class to help me do this but it is expecting the ObjectId in the following format:

time machine pid inc

However the current version of play-morphia produces:

_inc: 1378983320 _machine: 805577711 _new: false _time: 1402325534

Is it possible to create the top listed format? The Java Driver documention says the 'new' flag will be removed in v3. It is confusing with these deprecated 3 parameter constructors as well.

ThisThatBC commented 10 years ago

Ok, so the 3 parameter ObjectId will be replaced in v3 of the Java driver with the current representation. I need the string representation of the ObjectId when 'renderJSON' is called in Play. How can I do this? You have something in ObjectIdGsonAdapter.java.