I have the following document in a Mongo collection:
{ "_id" : ObjectId("5757fe72998660e2bc86b85f"), "projectCode" : "ABC", "projectName" : "ABC Dev", "sprintIssueCount" : { "bugs" : 17, "enhancements" : 7, "newFeatures" : 31 } }
I am then using Jongo (with Play Framework) to grab this from the database and put it into a Java class with:
return projects().findOne("{projectCode: #}", code).as(Project.class);
With the Project class containing the following fields:
@JsonProperty("_id")
public String id;
public String projectCode;
public String projectName;
public JsonObject sprintIssueCount;
However, sprintIssueCount returns empty { }. How can I grab the sub-document's contents?
Figured it out. Using Map instead of JsonObject:
public Map<String, Integer> sprintIssueCount;