I have the following view :
function (doc, meta) {
if (meta.type == “json”)
if ( doc.id
&& doc.id.root.indexOf(“1.2.250.1.199.16.1.1”) == 0
&& doc.setId
&& doc.versionNumber)
{
emit(doc.setId.extension, parseInt(doc.versionNumber.value))
}
}
That returns the following result set (WARNING PARTIAL):
Key Value
"4816f76e-33f9-456a-9e23-961799883994" 1
wound2QualificationRev1
“4816f76e-33f9-456a-9e23-961799883994” 2
wound2QualificationRev2
Now I would like to restrict the result set on the max value to return only
Key Value
"4816f76e-33f9-456a-9e23-961799883994" 2
wound2QualificationRev2
Because the result set is partial, I could not use sort/limit to achieve my goal.
How would I modify the view ? With a custom reduce method ?