ocampeau commented on issue #101: Query string not well formatted when key is 
an array of keys, no results found
URL: https://github.com/apache/couchdb-nano/issues/101#issuecomment-403183183
 
 
   I am closing this issue because after digging again, I have found that this 
is not a bug. For those of you who are experiencing the same issue, here's what 
I have found:
   
   1. If you want to search by compound key (ex: key:[value1, value2, value3]), 
you need to specify the FULL key. Doing
   ```
   db.view(dDoc, myView, {key:["Montreal", "Quebec"], reduce: false}, 
my_callback)
   ```
   won't work if the full key is ["Montreal", "Quebec", "Canada"].
   
   If you have some null values (ex: ["Montreal", "Quebec", null]), you need to 
specify null. You need the FULL key.
   
   2. If you want to search for part of that key (exemple "Montreal", "Quebec", 
*]), then you need to:
   
   ```
   db.view(dDoc, myView, {start_key:["Montreal", "Quebec"], 
end_key:["Montreal", "Quebec"], inclusive_end: false, reduce: false}, 
my_callback)
   ```
   or
   ```
   db.view(dDoc, myView, {keys:["Montreal", "Quebec"]}, my_callback)
   ```
   
   3. Also, note that when when using "keys" instead of "key", CouchDB expect a 
POST request, and not a GET request. That's (one of) the part that got me 
confused.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to