Hello!
In a collection I have 1 field which could be either ObjectId or UUID.
I've wrote class ObjectIdOrUUIDField and specified it as a field type:
This is allows me load objects from the collections but not save. If I tried to save the field is converted into JSON object either:Code:public class ObjectIdOrUUIDField implements Serializable { private UUID uuid; private ObjectId object_id; public ObjectIdOrUUIDField(UUID uuid) { this.uuid = uuid; } public ObjectIdOrUUIDField(ObjectId object_id) { this.object_id = object_id; } }
orCode:{ "m" : { "object_id" : ObjectId("512a4a7403648a7456929424") } }
But I need the following:Code:{ "m" : { "uuid" : BinData(3,"xIqiFeEaK499zB6ytJxZQw==") } }
orCode:{ "m" : ObjectId("512a4a7403648a7456929424") }
How can I do it?Code:{ "m" : BinData(3,"xIqiFeEaK499zB6ytJxZQw==") }


Reply With Quote