I want to query couchdb the same way I do mysql first using a url and also using nano:
SELECT * FROM people WHERE email = 'john@smith.xxx' AND password = 'password'
In nano I created my view:
db.insert(
{ "views":
{ "byLogin":
{ "map": function (doc) { if (doc.email === 'john@smith.xxx' && doc.password === 'password') emit([doc.firstname, doc.lastname], doc); }
}
}, '_design/people', function (error, response) {
console.log(response);
});
Trying to run the query in futon. So far the only reference I have found is the below:
http://127.0.0.1:5984/people/_design/people/_view/byLogin/?key=["john@smith.xxx","password]
Doesn't return any results. Any ideas?
In Nano I tried all the examples on github. This is the last one tried.
bd.view_with_list('people', 'byLogin', 'john@smith.xxx,password', function(err, body) {
if (!err) {
console.log(body);
}
});
Not working.