Hi,
I've got a view that is built from a map.js that looks like this:
function(doc)
{
if(doc['record type']=='search')
{
emit( [doc.status, doc.time], doc )
}
}
Where the doc.status field is a string that is either "Running" or "Finished"
and doc.time is a floating point value from 0 and up representing the time a
task took to complete.
I'd like to be able to query the documents that are 'Finished' and sort by
time. This query works:
... /_view/searches_by_status?startkey=["Finished",0]&include_docs=true
But it doesn't sort… So if I change it to:
...
/_view/searches_by_status?startkey=["Finished",0]&include_docs=true&descending=true
Then I only get values containing time=0
Why does adding the descending=true option change the results?
I've also tried this:
…
/_view/searches_by_status?startkey=["Finished",0]&endkey=["Finished",9999.9999]&include_docs=true&descending=true
But this one doesn't return anything.
Is there a way to query this view to get records with a particular value in the
doc.status field and still sort the fields?
Thanks in advance for any advice and/or help!
-William