【问题标题】:PouchDB return 404 on design docucment even if this document existPouchDB 在设计文档上返回 404,即使该文档存在
【发布时间】:2023-03-14 13:42:01
【问题描述】:

这个命令...

this._db.query(`classRoom_ZSFtmZiBu/robots`, {
    classRoomCode: this.classRoomCode,
}).then(res => res.rows.map(it => it.key));

抛出 404 错误...

即使设计文档存在于数据库中..

  "_id": "_design/classRoom_ZSFtmZiBu",
  "_rev": "1-667891751ba8a733dc1976172de9b513",
  "views": {
    "robots": {
      "map": "function (doc) {\n                if (doc.type === \"robot\") {\n                  emit(doc);\n                }\n              }"
    }
  },
  "filters": {
    "robotsOnThisClassRoomOnly": "function (doc, req) {\n              return doc.type === \"robot\" && doc.classRoom === req.query.classRoomCode;\n            }"
  }

【问题讨论】:

    标签: nosql couchdb pouchdb


    【解决方案1】:

    我没有重现您的问题。我使用 CouchDB 2.1

    以下是我的截图。

    我有两份文件,其中一份是和你一样的设计文件。

    现在我在浏览器中使用 CouchDB 进行查询。

    这是开发控制台上的查询结果。

    【讨论】:

    • 我会尝试更改版本。我在 Apache CouchDB 1.6.1 上使用 Fauxton
    • 您使用的是 MAC 吗?您是在 localhost 还是通过 IP/域进行测试?在我的机器中......只有当我使用 IP 地址时才会发生此错误
    • 好的。我会试试IP
    猜你喜欢
    • 2014-12-11
    • 2015-09-06
    • 1970-01-01
    • 1970-01-01
    • 2018-09-26
    • 2021-05-08
    • 2019-10-02
    • 1970-01-01
    • 2019-01-19
    相关资源
    最近更新 更多