【问题标题】:Obtaining the list of document revisions in PouchDB when Upsert plugin is used使用 Upsert 插件时获取 PouchDB 中的文档修订列表
【发布时间】:2018-02-09 22:57:22
【问题描述】:

我正在构建一个 ElectronJS 应用程序并使用 PouchDB 在本地存储一个文档列表。我正在使用 pouchdb-upsert 插入新记录。它还在数据库中创建修订,我可以很好地看到它们。

PouchDB data screen capture

问题是我无法使用db.get 获取特定修订版或使用db.bulkGet 在PouchDB 的文档之后使用其中的一批。在这两种情况下,我都会从数据库中收到 404 错误。

我需要能够以 PouchDB 文档的形式获取修订列表,以便用户能够在编辑文档时维护其文档的历史记录,或者在需要时将修订分叉为新文档。类似于 google 文档历史记录功能。如何获取 upsert 插件创建的修订列表?

【问题讨论】:

    标签: pouchdb revisions


    【解决方案1】:

    fetching a document 时可以使用一些选项来获取所有修订的列表:

    db.get(docId, [options], [callback])
    ...
    options.revs: Include revision history of the document.
    ...
    

    也看看这个related answer

    【讨论】:

      猜你喜欢
      • 2017-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多