Reputation: 351
I have a following document structure in mongo
{
"_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. "id" field has no index on it, and is not used to uniquely identify this document. Has anyone faced something similar and any work around for it ?
P.S. I am using mongo 3.6, with 3.6 async driver.
Upvotes: 1
Views: 1688
Reputation: 351
This is indeed a feature/bug in mongodb java driver. Anyone looking for a reason and a solution for this can find one here https://jira.mongodb.org/browse/JAVA-2750
Upvotes: 4