Thanks for your feedback Paul.

On 27 January 2011 23:57, Paul Davis <[email protected]> wrote:
> You're best bet would be to make another view that you can use to get
> what you want. For instance, if you want the revisions that existed
> for a given document before a certain time just create a second view
> that doesn't include the part in the key and then you can grab per
> document all revisions for a given document before (or after) a given
> timestamp.

So are you suggesting I make a view that outputted something like this?

["document1",1294696806874] -> {"content": "part 1.1, revision 3"}
["document1",1294696793572] -> {"content": "part 1.1, revision 2"}
["document1",1294696769516] -> {"content": "part 1.1, revision 1"}
["document1",1294696816974] -> {"content": "part 1.2, revision 2"}
["document1",1294696761684] -> {"content": "part 1.2, revision 1"}
["document1",1294696709610] -> {"content": "part 1.3, revision 1"}
["document2",1294696812168] -> {"content": "part 2.1, revision 3"}
["document2",1294696802362] -> {"content": "part 2.1, revision 2"}
["document2",1294696743154] -> {"content": "part 2.1, revision 1"}
["document2",1294696819313] -> {"content": "part 2.2, revision 1"}

I can see how from this I can get all of the parts for a specified
document before a specified date (without the need of a reduce
function), which seems like a good start, but I can't find a way to
group over the document 'part'.

For example, I can specify a startkey and endkey of '["document1",0]'
and '["document1",1294696793572]' to get all revisions for 'document1'
before the specified timestamp:

["document1",1294696793572] -> {"content": "part 1.1, revision 2"}
["document1",1294696769516] -> {"content": "part 1.1, revision 1"}
["document1",1294696761684] -> {"content": "part 1.2, revision 1"}
["document1",1294696709610] -> {"content": "part 1.3, revision 1"}

But I'm still stuck when it comes to finding a way to remove all the
revisions before the last one (in this case, the document for "part
1.1, revision 1" needs to be removed since this is superseded by
"revision 2").

I hope that makes sense.

Any further suggestions?

I'm wondering if perhaps a document-oriented database isn't quite
suited to my case :(

Reply via email to