Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 10451 invoked from network); 11 Nov 2010 20:38:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Nov 2010 20:38:02 -0000 Received: (qmail 39722 invoked by uid 500); 11 Nov 2010 20:38:32 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 39680 invoked by uid 500); 11 Nov 2010 20:38:32 -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 39672 invoked by uid 99); 11 Nov 2010 20:38:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Nov 2010 20:38:32 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of luis.junges@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-ew0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Nov 2010 20:38:26 +0000 Received: by ewy6 with SMTP id 6so666616ewy.11 for ; Thu, 11 Nov 2010 12:38:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=xoW1XMeD3XEQgWWM746ZHEYQSznDmbBgpMV1EEIpFBc=; b=X0Wx4Vb3eulb0zbsDLZIPLWEuOPH5f+D5dHmaKVotJAiVhKE1gOEn2EuKf77OeRw68 7+9iyfZyFlUCOoeTYWLsWguW1itPbTcAc6ey2TylGnHddv8JfRYsK04EcpvUl1czRV5C sLKSZlxMNtNXHeV4+JctdXK6p82o0tzBcdPMI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=j1qxsNomhBFaKKK6LN0rqCBMZ8KbNqbidneEx3HK8cpa6gv4wsQp5byKB1Ba9vOWoY WY5/mY6LMXwJqGUECQvLbJdeRlTN+TL1eVAmBbnreRm+EkXkmgFdAb94Z1Dw6EGYCo/U d3cFDQhS3JFsTu1cHRn88+/FBZ4MbDEoZWBFY= MIME-Version: 1.0 Received: by 10.216.51.21 with SMTP id a21mr1190080wec.50.1289507883897; Thu, 11 Nov 2010 12:38:03 -0800 (PST) Received: by 10.216.54.21 with HTTP; Thu, 11 Nov 2010 12:38:03 -0800 (PST) Date: Thu, 11 Nov 2010 18:38:03 -0200 Message-ID: Subject: CouchDB model Problem From: Luis Carlos Junges To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016e6dd85cc5ad2770494ccf353 --0016e6dd85cc5ad2770494ccf353 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, I would like to use couchdb for a project but i am unsure how to model it. Basically i will have to store products and theirs respectives prices from several stores. So, for a product product1, for example, i will have a price p1 for store1, a price p2 for store 2 and so on...Considering that those prices will be updated automatically, i was thinking in something lik= e this: A document for the product with all information about it with id equal to the product reference number example: id:product1 name: Product 1 A document with the price and store id id:89923848298398989d9fsd revision:1 store:45 price:5.67 refcode:product1 updated: timestamp here id:8992384829832938495298345 revision:3 store:46 price:3.67 refcode:product1 updated: timestamp here My idea is that each store will update their own prices. Now the problem i am no sure how to solve is that i can have multiple price documents with differents ids (see example below) for the same store (a database inconsistency). Could i use mapreduce to collect all the price documents fo= r a specific product and get only the latest one based on the time is updated. If so, how can i do that? i mean, how would be the map and reduce function? I would also like to delete the old ones. id:8992384829832938495298345 revision:1 store:46 price:3.67 refcode:product1 updated timestamp here id:92839198234 revision:1 store:46 price:6.23 refcode:product1 updated timestamp here I would appreciate any help --=20 "A realidade de cada lugar e de cada =E9poca =E9 uma alucina=E7=E3o coletiv= a." Bloom, Howard --0016e6dd85cc5ad2770494ccf353--