couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mclendon, William C III" <>
Subject Querying a view with a complex key with a wildcard
Date Tue, 29 Mar 2011 18:39:10 GMT

I've got a view that is built from a map.js that looks like this:

  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

... /_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!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message