Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5B0179064 for ; Thu, 2 Feb 2012 23:35:34 +0000 (UTC) Received: (qmail 90034 invoked by uid 500); 2 Feb 2012 23:35:31 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 89436 invoked by uid 500); 2 Feb 2012 23:35:30 -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 89418 invoked by uid 99); 2 Feb 2012 23:35:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2012 23:35:29 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of wilson.jim.r@gmail.com designates 209.85.212.178 as permitted sender) Received: from [209.85.212.178] (HELO mail-wi0-f178.google.com) (209.85.212.178) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Feb 2012 23:35:23 +0000 Received: by wibhm14 with SMTP id hm14so2924922wib.23 for ; Thu, 02 Feb 2012 15:35:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=lF6C2gf7A/5Oo7ZJFoupYTPgniQZhIzLpFZPBQVYt7Q=; b=NRYAgrT+h3LlJf+U2iJSgiBmBhgNL3pLzGp21oO69T3e3f616G1c/7ZSMrUmk9ykR0 5sULACbzWFsnnf1mWl7LzITxIGDJ82BXgzftjWwsBcoIW1qsG6BRvewAPtgKRArkEBif pQuiWN6g+tlK3/0ySsLkoiUR2hCrUSpI7n1po= MIME-Version: 1.0 Received: by 10.180.86.198 with SMTP id r6mr21461213wiz.2.1328225701905; Thu, 02 Feb 2012 15:35:01 -0800 (PST) Received: by 10.223.116.193 with HTTP; Thu, 2 Feb 2012 15:35:01 -0800 (PST) In-Reply-To: <50755639-111B-411A-8FDA-EA162DB97811@gmail.com> References: <50755639-111B-411A-8FDA-EA162DB97811@gmail.com> Date: Thu, 2 Feb 2012 18:35:01 -0500 Message-ID: Subject: Re: Retrieving Multiple Revisions From: "Jim R. Wilson" To: user@couchdb.apache.org Cc: couchdb-user@apache.org Content-Type: multipart/alternative; boundary=f46d04428c0824c3db04b803a583 --f46d04428c0824c3db04b803a583 Content-Type: text/plain; charset=ISO-8859-1 Hi Jon, Revisions are stored in CouchDB for the purpose of conflict resolution, but you can't count on them hanging around forever. Whenever you compact the database, old revisions are purged. Your best bet is to store messages as their own documents, or group some number of messages together into a container document. Hope this helps! -- Jim R. Wilson (Seven Databases in Seven Weeks) On Thu, Feb 2, 2012 at 6:30 PM, Jon Morehouse wrote: > Hello, > I'm creating a chat application based on revision history for > documents. Each new post is a new revision in my chat room and I am simply > querying multiple revisions to update each post. My question is, how do I > work with the individual revisions inside of the returned object? > > Here Is what I'm getting when I print it recursively with PHP, I would > like to go in and loop through each json document to make a nicer output: > > --c89953e79622d85ed9037f797611162f Content-Type: application/json > {"_id":"ben","_rev":"1-8159fce5e15466f7ebbffce24824ed6a","message":"this is > the first message in this chatroom"} --c89953e79622d85ed9037f797611162f > Content-Type: application/json > {"_id":"ben","_rev":"2-c6d8d60b58e0d34e9d7bde15c7f57d6d","username":"Ben","message":"BenMessage"} > --c89953e79622d85ed9037f797611162f Content-Type: application/json > {"_id":"ben","_rev":"3-6e11c76fa6ac5b38d05c210d1d51d941","username":"Ben","message":"BenMessage"} > -- > > Also, for future reference is it good practice to work with revisions like > this? > > > > Jon Morehouse > Moeller High School Class of 2009 > Pepperdine University 2009-2010 > University of Southern California Class of 2013 > > > > > --f46d04428c0824c3db04b803a583--