From user-return-6214-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Mon Aug 31 00:29:53 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 84178 invoked from network); 31 Aug 2009 00:29:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Aug 2009 00:29:53 -0000 Received: (qmail 6085 invoked by uid 500); 31 Aug 2009 00:29:52 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 6008 invoked by uid 500); 31 Aug 2009 00:29:52 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 5998 invoked by uid 99); 31 Aug 2009 00:29:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Aug 2009 00:29:52 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [203.39.221.210] (HELO hydratech.com.au) (203.39.221.210) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Aug 2009 00:29:43 +0000 Received: from [10.8.0.115] (unknown [10.8.0.115]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by hydratech.com.au (Postfix) with ESMTP id 2A7D35755D for ; Mon, 31 Aug 2009 10:27:25 +1000 (EST) Message-ID: <4A9B198D.9010904@hydratech.com.au> Date: Mon, 31 Aug 2009 10:30:05 +1000 From: Andrew Mee User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090608 Thunderbird/2.0.0.22 ThunderBrowse/3.2.6.1 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Best way to handle data? Advice wanted Content-Type: multipart/alternative; boundary="------------050502000000080108090800" X-Virus-Checked: Checked by ClamAV on apache.org --------------050502000000080108090800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I have been using CouchDB (trunk) for a couple of weeks now and while I have a good grasp on the way it handles data I am unsure the best way to store some of this data for retrieval purposes. I'll be honest upfront I have some from an SQL background and so I'm still getting my head around some of the concepts and while I could have done this in SQL without a worry, I like the idea of the object and schema-less storage and the replication option that CouchDB has. Currently one of the document types I am storing is some time tracking data it look a little like this: { "|_id|":|"t125142312603660"|, "|_rev|":|"1-14095bf3c015575a4dc5ec3c7aea1234"|, "|task|":|"blah"|, "|cc|":|"HYD"|, "|timestamp|":|1251423124|, "|pc|":|"SPR"|, "|duration|":|5|, "|username|":|"andrew"| } The timestamp field is a utc unix timestamp. I have been using views with map and reduce functionality to collate this data into the data I want. However my issue comes when I want to only look at data between particular time stamps. I thought about collating it for a given day do it looked like (format is bad I know!): key:["2009-08-26","HYD","SPR","blah"], value: 100 ; where value is summed value of durations. But this doesn't work for situations of different timezones. I thought that I may be able to use startkey/endkey docid and use the time stamp as the docid to filter the documents used for the reduce - but this doesn't seem to be the way it works. (Am I wrong??) I did think about using an external process, but this only works as both a map and reduce not just a reduce option. I am interested to know your thought on the best way to handle this data and retrieve it? Regards Andrew M --------------050502000000080108090800--