couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nils Breunese <N.Breun...@vpro.nl>
Subject RE: Retrieving Multiple Revisions
Date Fri, 03 Feb 2012 09:26:19 GMT
You should not build applications on CouchDB's revision system. http://wiki.apache.org/couchdb/Document_revisions
says: "You cannot rely on document revisions for any other purpose than concurrency control.
Due to compaction, revisions may disappear at any time. You cannot use them for a client revision
system."

I suggest looking at other ways to solve your problem, like for instance creating a document
per message with a chatroom and a timestamp property and a view to collect all messages by
chatroom and timestamp.

If you really want to do version control using CouchDB (which I don't believe is what you
should be looking at for a chat application) check out this blog post:

Simple Document Versioning with CouchDB
http://blog.couchbase.com/simple-document-versioning-couchdb

Nils.
________________________________________
Van: Jon Morehouse [morehousej09@gmail.com]
Verzonden: vrijdag 3 februari 2012 0:30
Aan: couchdb-user@apache.org
Onderwerp: Retrieving Multiple Revisions

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




------------------------------------------------------------------------
 VPRO   www.vpro.nl
------------------------------------------------------------------------

Mime
View raw message