2

PouchDB 和 Mango 似乎都缺少在索引查询中包含文档先前版本的选项。

这样的选项可能类似于:include_revs: true

因此,例如,要在特定时间戳之前检索存储桶中用户个人资料文档的所有版本的列表,它可能看起来像这样:

db.createIndex({
    index: {
         fields: [ 'user_id', 'type', 'timestamp' ],
         ddoc: 'all_versions',
         include_revs: true
    }
}).then(function(){
    db.find({
        selector: {
            user_id: specific_user,
            type: 'profile',
            timestamp: { $lte: specific_timestamp }
        },
        use_index: 'all_versions'
    }).then(function(results){
        // do something with revisions
    })
})

此功能似乎对于处理合并冲突以及任何了解先前状态很重要的情况非常有用。是否有它丢失的原因?

4

1 回答 1

1

更改include_revs: truerevs:true'revs_info:true oropen_rev: 'all` 以获取转速数组。查看这些答案使用更改提要时,有没有办法在 PouchDB 中获取文档的所有修订?

于 2018-01-26T07:00:27.900 回答