Hi Randall Thanks, I'm aware of the ability to split out the date into multiple keys for easier collation. However that's not really the issue here. My problem is with the additional level of sorting that might be required to make the reduced data meaningful. ie I want to know only about oranges and not other fruit in my particular date time collation.
Matthew On Sat, Aug 6, 2011 at 12:19 AM, Randall Leeds <[email protected]>wrote: > On Fri, Aug 5, 2011 at 15:00, Matthew Slade > <[email protected]> wrote: > > Hi Zach (and everyone else) > > > > Thanks for the info. Unfortunately my game is already big and the > proposed > > solution wouldn't really be suitable although _lists seem interesting and > > I'll definitely investigate them. I do find this quite a limitation to > > couchdb especially when one is working a lot with dated documents. > > > > Another question I have in a similar vein: > > > > Given a set of documents being created for transaction for the purchase > of > > fruit for example. > > > > * { > > "_id":"uniqueOrderId", > > "dateOfPurchase": "2011-07-06T10:24:52", > > "itemId": "oranges" > > }* > > > > Could one collate the view entries by the date and then reduce based off > of > > part of the value. ie How could I easily answer the question "*How many > > oranges were sold on Wednesday*?" efficiently with potentially huge > numbers > > of transaction documents in my database. > > You should separate the key you emit into an array of the date pieces > like [YYYY, MM, DD, ...]. > Then you can use ?group_level=X with your reduce query to get hourly, > daily, monthly, etc summaries. > > -Randall
