使用 nano 查询 couchdb 中的多个字段



我想像我首先使用 url 和 nano 一样查询 couchdb

SELECT * FROM people WHERE email = 'john@smith.xxx' AND password = 'password'

在纳米中,我创建了我的视图:

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);
  }
});

不工作。

此代码不起作用,因为 sql 查询在从数据库中读取数据时运行,但在将数据保存到数据库时运行 couchdb 视图。