Jason S
Jason S

Reputation: 189626

couchapp: query with a key?

Could someone point me to an example of a Couchapp application that queries a view with a key based on user input from an HTML form?

I can't seem to either figure out how to do this or find an example on my own via google.

Upvotes: 0

Views: 128

Answers (1)

Jason S
Jason S

Reputation: 189626

I figured it out:

If you're using evently, then in /evently/[whatever]/_changes, instead of a fixed query.json, you can replace it with a query.js where you can dynamically return a query, e.g.:

function() {
  var key = /* ... */
  // get your key from the appropriate source (jquery, current page's URL, etc) 
  return {
    "view" : "recent-items",
    "key" : key,
    "limit" : 50
  }
}

Upvotes: 2

Related Questions