couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Scheliga <>
Subject Re: Retrieving Multiple Revisions
Date Thu, 02 Feb 2012 23:40:28 GMT
Hi jon,

its not a good idea to rely on document revisions, they are prune on compaction, you have
to create your own new documents if you want to implement versioning and stuff. i think its
generally a bad idea to  do it that way. you can also create just one document per user and
merge their posts in a view for the chat. the app itself could use the _changes feed.


Am 03.02.2012 um 00:30 schrieb Jon Morehouse:

> 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
--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

Sourcegarden GmbH HR: B-104357
Steuernummer: 37/167/21214 USt-ID: DE814784953
Geschaeftsfuehrer: Mario Scheliga, Rene Otto
Bank: Deutsche Bank, BLZ: 10070024, KTO: 0810929
Karl-Liebknecht-Str. 5, 10178 Berlin

View raw message