I'm new to couchdb, I have a two-key design. I use node to list view. In any case, I can only pass one key from node and if it matches either of the two keys from couchdb and gets the result.
My design in couchdb:
function(doc) {
if(doc.doc_type==="messages")
emit([doc.from, doc.to], doc);
}
Passing a key using node
db.view('message','fetch_msg',{key:"user1"}, function(err, body) {
if(err)console.log(JSON.stringify(err))
console.log(body.rows.length)
console.log(JSON.stringify(body));
})
Like "user1", this is one of the keys. message / fetch_msg is my design.
Any help would be appreciated.
source
share