Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

What is the keys in view function based on? Is it the key you emit in the views/map function? #354

Open
flynsequeira opened this issue Aug 9, 2017 · 1 comment

Comments

@flynsequeira
Copy link

the param in view function - {keys: [key1,key2]}
is the key based on the emit part of the view function? If so, will I be able to set anything as key, like the _id?
views: {
"all": {
"map": "function(doc){if(doc) emit(doc._id,null)}"
}
}
If this is not the case, could you please clarify as to what keys refers to OR how I can query based on an array of id?

@jo
Copy link
Contributor

jo commented Aug 9, 2017

Hi @flynsequeira,

yes, key is what you emit as key in your view function. You can emit everything you like as keys, I often use arrays. Normally you don't need to set up a view with _id keys, because the built in _all_docs view has _id as key. You can use nanos list API for that.

See http://docs.couchdb.org/en/2.1.0/api/ddoc/views.html for information about how to query keys.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants