【发布时间】:2019-05-23 15:41:20
【问题描述】:
我想以与 mysql 相同的方式查询 couchdb,首先使用 url 并使用 nano:
SELECT * FROM people WHERE email = 'john@smith.xxx' AND password = 'password'
在 nano 我创建了我的视图:
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);
});
尝试在蒲团中运行查询。到目前为止,我找到的唯一参考如下:
http://127.0.0.1:5984/people/_design/people/_view/byLogin/?key=["john@smith.xxx","password]
不返回任何结果。有什么想法吗?
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);
}
});
不工作。
【问题讨论】:
标签: node.js couchdb couchdb-nano