Both PouchDB and Mango seem to be missing an option to include previous versions of a document in an index query.
Such an options might look something like: include_revs: true
So, for example, to retrieve a list of all the versions of a user's profile documents in a bucket prior to a specific timestamp, it might look something like this:
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
})
})
This feature seems like it would be very useful for handling merging conflicts as well as any situations where knowledge of the previous state matters. Is there a reason for why it is missing?