couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Reduce parameters?
Date Tue, 01 Feb 2011 16:08:57 GMT
I'm not entirely certain what you're wanting for output. Could you
give an example of what you'd hoped to achieve?

On Mon, Jan 31, 2011 at 3:58 PM, Joe Freeman <joe.freeman@bitroot.com> wrote:
> Thanks for your feedback Paul.
>
> On 27 January 2011 23:57, Paul Davis <paul.joseph.davis@gmail.com> 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 :(
>

Mime
View raw message