Ajith Renjala
Ajith Renjala

Reputation: 5152

Couchdb - query.keys with empty dictionary

I've written a map function that has

emit([doc.university,doc.degree,doc.studentName],1)

Now, I'd like to query the exact rows (not a key range) as following

query.keys = [[university1,degree1,{}],[university2,degree2,{}]]

Is this possible with CouchDB querying option- Keys? I'm fetching all the students (sorted based on their name) that belong to specific degrees and universities.

P.S I'm an iOS dev working with Couchbase-lite and not an expert on CouchDB.

Upvotes: 1

Views: 188

Answers (1)

Petter
Petter

Reputation: 1337

No this is not possible since there is no wildcards in couchDB, but you could easily achieve the same result by creating a new view that is the same as your current one but emits:

emit([doc.university,doc.degree],doc.studentName)

and use the query:

query.keys = [[university1,degree1],[university2,degree2]]

Upvotes: 1

Related Questions