-
Type: Task
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: POJO
-
None
{ "_id" : 4771902, "upc" : "test-upc-v1", "reportingCategory" : { "id" : 14, "department" : "Footwear" } }
My java class looks like
public class Product { private Long _id; private String upc; private ReportingCategory reportingCategory; }
public class ReportingCategory { private Long id; private String department; }
I am using mongo pojo codec for conversion. "id" field under ReportingCategory is being returned as null. Rest every other data is available. I can see that data when I convert it into RawBsonDocument, but seems like it gets lost in pojo conversion.
Seems like, if pojo has any member with name "id" it by defaults map it to "_id" field of mongo document. Here reporting category is sub document which has no "_id" field, and just some field which is happened to be named "id"