How to set the descending, group and group_level parameters?

Asked by Pitarou

I understand that I can choose a particular key, or range of keys, for a view using index and slice notation. E.g.:

results = db.execute_view("my_view", "my_design_doc")
all_keys = list(results)
just_one_key = list(results["a key"])
keys_1_to_9 = list(results["key_1":"key_9"])

Am I correct in thinking that the above code runs 3 crouch queries with different settings for the key, startkey and endkey parameters?

What about other parameters? How do I ask for things like descending, group and group_level? Or am I using the wrong module if I want to do these things?

Question information

Language:
English Edit question
Status:
Answered
For:
desktopcouch Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stuart Langridge (sil) said :
#1

Owing to an oversight, it's a bit more difficult to pass extra options to a view in desktopcouch.records than it should be, and thanks for bringing this up so we can fix it! So, at the moment, you can execute the view directly from the database object, like this:

results = mycouchdatabase.db.view("_design/%s/_view/%s" % (design_doc, view_name), { "descending": true })

and we'll fix execute_view so it can also take this extra set of parameters. Thanks very much for the feedback!

Revision history for this message
Stuart Langridge (sil) said :
#2

(I've linked the outstanding bug for fixing this, and I've just submitted a branch to add the extra parameters for code review, although obviously this change won't make it into a released package for a while.)

Can you help with this problem?

Provide an answer of your own, or ask Pitarou for more information if necessary.

To post a message you must log in.