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