I'm trying to query an array of nested documents in mongodb, and also get the highest value of a particular field in that nested document. (In java)
Here is an example of the document structure, where I want to find the largest value of the "value" field in the array.
{
"_id" : ObjectId("526d89571cd72ce9dbb6b443"),
"array" : [
{"text" : "this is a nested document", "value" : 1 },
{"text" : "this is another nested document", "value" : 2 }
]
}