From nlamirault at gmail.com Thu Jun 5 16:34:33 2008 From: nlamirault at gmail.com (Nicolas Lamirault) Date: Thu, 05 Jun 2008 18:34:33 +0200 Subject: [clouchdb-devel] problem to retrieve document versions Message-ID: <87bq2flu1y.fsf@perave.org> hi, i make some tests with clouchdb. CL-USER> (clouchdb:get-document "G21903421662498" :revision-info t) ((:|_id| . "G21903421662498") (:|_rev| . "3836974416") (:TITLE . "Paste 2008-06-05 15:48:18") (:USERNAME . "lam") (:DATE . "2008-06-05 18:14:14") (:CODE . " Test this paste") (:|_revs_info| ((:|rev| . "3836974416") (:|status| . "available")) ((:|rev| . "3249839272") (:|status| . "available")))) i would like to check if more than one version of a document is available. But i can't really find how to do that in documentation. CL-USER> (clouchdb:document-properties *) ((:CODE . " Test this paste") (:DATE . "2008-06-05 18:14:14") (:USERNAME . "lam") (:TITLE . "Paste 2008-06-05 15:48:18")) ex: CL-USER> (clouchdb:get-document "G21903421662498" :revision-info t) ((:|_id| . "G21903421662498") (:|_rev| . "3836974416") (:TITLE . "Paste 2008-06-05 15:48:18") (:USERNAME . "lam") (:DATE . "2008-06-05 18:14:14") (:CODE . " Test this paste") (:|_revs_info| ((:|rev| . "3836974416") (:|status| . "available")) ((:|rev| . "3249839272") (:|status| . "available")))) CL-USER> (clouchdb:document-property :_revs_info *) NIL any idea ? thanks for this CouchDB client ! -- Nicolas Lamirault From peter.eddy at gmail.com Thu Jun 5 17:37:31 2008 From: peter.eddy at gmail.com (Peter Eddy) Date: Thu, 5 Jun 2008 13:37:31 -0400 Subject: [clouchdb-devel] problem to retrieve document versions In-Reply-To: <87bq2flu1y.fsf@perave.org> References: <87bq2flu1y.fsf@perave.org> Message-ID: <5aea26870806051037w6285dadav90574c5cf4a788aa@mail.gmail.com> On Thu, Jun 5, 2008 at 12:34 PM, Nicolas Lamirault wrote: > > hi, > i make some tests with clouchdb. > > CL-USER> (clouchdb:get-document "G21903421662498" :revision-info t) > ((:|_id| . "G21903421662498") (:|_rev| . "3836974416") > (:TITLE . "Paste 2008-06-05 15:48:18") (:USERNAME . "lam") > (:DATE . "2008-06-05 18:14:14") (:CODE . " Test this paste") > (:|_revs_info| ((:|rev| . "3836974416") (:|status| . "available")) > ((:|rev| . "3249839272") (:|status| . "available")))) > > i would like to check if more than one version of a document is > available. But i can't really find how to do that in documentation. Hi Nicolas, You could do: (document-property :|revs_info| (get-document "G21903421662498" :revision-info t)) Don't forget the vertical bars for the document property name, i.e. :|revs_info| not :revs_info. That should return: (((:|rev| . "3836974416") (:|status| . "available")) ((:|rev| . "3249839272") (:|status| . "available")))) Which should be a list of two lists, each describing one revision. Note that you shouldn't think of the revision feature as a kind of version control. Older revisions are used for replication in Couchdb, and will be deleted automatically. This automatic deletion doesn't happen in any released version of Couchdb now, but it will when Couchdb 1.0 is released. - Peter > CL-USER> (clouchdb:document-properties *) > ((:CODE . " Test this paste") (:DATE . "2008-06-05 18:14:14") > (:USERNAME . "lam") (:TITLE . "Paste 2008-06-05 15:48:18")) > > ex: > > CL-USER> (clouchdb:get-document "G21903421662498" :revision-info t) > ((:|_id| . "G21903421662498") (:|_rev| . "3836974416") > (:TITLE . "Paste 2008-06-05 15:48:18") (:USERNAME . "lam") > (:DATE . "2008-06-05 18:14:14") (:CODE . " Test this paste") > (:|_revs_info| ((:|rev| . "3836974416") (:|status| . "available")) > ((:|rev| . "3249839272") (:|status| . "available")))) > CL-USER> (clouchdb:document-property :_revs_info *) > NIL > > any idea ? > thanks for this CouchDB client ! > > > -- > Nicolas Lamirault > _______________________________________________ > clouchdb-devel mailing list > clouchdb-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/clouchdb-devel > From Feed at common-lisp.net Mon Jun 9 07:21:08 2008 From: Feed at common-lisp.net (Feed at common-lisp.net) Date: 09 Jun 2008 00:21:08 -0700 Subject: [clouchdb-devel] Feed Blaster puts your ad right to the screens of millions in 15 Minutes ! Message-ID: <20080609002107.82D5BAB24CE52BDC@from.header.has.no.domain> More and more people are subscribing to feeds every day and there are millions who are already subscribed. Thus, your ad will reach a very broad range of potential customers with each use of Feed Blaster! Feed Blaster is the first & only submitter that can submit your ads to thousands of feeds within a few minutes! Post your ads where people read them! - What if you could place your ad into all these feeds ? Right, that would mean you would have millions of sites linking to your ad - and millions of users reading your message within minutes - and my idea actually works For Full details please read the attached .html file Unsubscribe: On Full details page click on contact form -------------- next part -------------- An HTML attachment was scrubbed... URL: From ch at mr-co.de Fri Jun 13 22:14:02 2008 From: ch at mr-co.de (Christian Haselbach) Date: Sat, 14 Jun 2008 00:14:02 +0200 Subject: [clouchdb-devel] Problems with document-to-json Message-ID: <4852F12A.8050204@mr-co.de> Hello, Sorry for sending this twice. The subscription was not quite finished. So I'm not sure if the first mail got through. I'm just experimenting with clouchdb. As noted in the news section of clouchdb, CouchDB's view API changed in 0.8. I wanted to adjust the corresponding methods in clouchdb. This worked fine for the ad-hoc view, but in the create view I ran into a problem with document-to-json. I think it does not handle nested maps correctly, or at least not like cl-json. For example this create document statement: (create-document '((name . "Hi there2") (content . ((foo . "bar") (bla . "fasel"))) (nested . ((foo . ((bla . ((fasel . "zort")))))))) :id "hithere2") will result in this document: {"_id":"hithere2","_rev":"1840089990", "NAME":"Hi there2", "CONTENT":{"FOO":"bar","BLA":"fasel"}, "NESTED":[["FOO",["BLA",["FASEL"]]]]} CONTENT looks fine, but NESTED not so much. Observe the following differencs in document-to-json an encode-json-to-string: (json:encode-json-to-string '((foo . ((bar . baz))))) "{\"foo\":{\"bar\":\"baz\"}}" (clouchdb::document-to-json '((foo . ((bar . baz))))) "[[\"FOO\",[\"BAR\",]]]" Is this intendend? Thanks and regards, Christian From ch at mr-co.de Fri Jun 13 22:11:11 2008 From: ch at mr-co.de (Christian Haselbach) Date: Sat, 14 Jun 2008 00:11:11 +0200 Subject: [clouchdb-devel] Problems with document-to-json Message-ID: <4852F07F.9030508@mr-co.de> Hello, I'm just experimenting with clouchdb. As noted in the news section of clouchdb, CouchDB's view API changed in 0.8. I wanted to adjust the corresponding methods in clouchdb. This worked fine for the ad-hoc view, but in the create view I ran into a problem with document-to-json. I think it does not handle nested maps correctly, or at least not like cl-json. For example this create document statement: (create-document '((name . "Hi there2") (content . ((foo . "bar") (bla . "fasel"))) (nested . ((foo . ((bla . ((fasel . "zort")))))))) :id "hithere2") will result in this document: {"_id":"hithere2","_rev":"1840089990", "NAME":"Hi there2", "CONTENT":{"FOO":"bar","BLA":"fasel"}, "NESTED":[["FOO",["BLA",["FASEL"]]]]} CONTENT looks fine, but NESTED not so much. Observe the following differencs in document-to-json an encode-json-to-string: (json:encode-json-to-string '((foo . ((bar . baz))))) "{\"foo\":{\"bar\":\"baz\"}}" (clouchdb::document-to-json '((foo . ((bar . baz))))) "[[\"FOO\",[\"BAR\",]]]" Is this intendend? Thanks and regards, Christian From peter.eddy at gmail.com Sat Jun 14 22:12:20 2008 From: peter.eddy at gmail.com (Peter Eddy) Date: Sat, 14 Jun 2008 18:12:20 -0400 Subject: [clouchdb-devel] Problems with document-to-json In-Reply-To: <4852F12A.8050204@mr-co.de> References: <4852F12A.8050204@mr-co.de> Message-ID: <5aea26870806141512y3bf44bb2o8462a83d341d436e@mail.gmail.com> Hi Christian, thanks for trying out clouchdb. On Fri, Jun 13, 2008 at 6:14 PM, Christian Haselbach wrote: > I'm just experimenting with clouchdb. As noted in the news section of > clouchdb, CouchDB's view API changed in 0.8. I wanted to adjust the > corresponding methods in clouchdb. This worked fine for the ad-hoc view, > but in the create view I ran into a problem with document-to-json. I > think it does not handle nested maps correctly, or at least not like > cl-json. I've just checked changes into CVS to support the new CouchDb views. There are examples of their use in examples.lisp and test.lisp, but not yet in the HTML doc. Here's a quick example based on an example from the CouchDb views wiki page http://wiki.apache.org/couchdb/HttpViewApi (create-ps-view "views" (ps-view ("all") (defun map (doc) (if (eql doc.type "customer") (emit null doc)))) (ps-view ("total_purchases") (defun map (doc) (if (eql doc.type "purchase") (emit doc.customer doc.amount))) (defun reduce (keys values) (return (sum values))))) The create-ps-view is a simple method that just assumes the view language is JavaScript. The ps-view is a macro, and everything after the name ("all" or "total_purchases") is parenscript. You can evaluate ps-view in the REPL and see the JavaScript output, which makes for easy debugging. > For example this create document statement: > (create-document '((name . "Hi there2") > (content . ((foo . "bar") (bla . "fasel"))) > (nested . ((foo . ((bla . ((fasel . "zort")))))))) > :id "hithere2") > will result in this document: > {"_id":"hithere2","_rev":"1840089990", > "NAME":"Hi there2", > "CONTENT":{"FOO":"bar","BLA":"fasel"}, > "NESTED":[["FOO",["BLA",["FASEL"]]]]} > > CONTENT looks fine, but NESTED not so much. That looks like a bug, see next comment > Observe the following differencs in document-to-json an > encode-json-to-string: > (json:encode-json-to-string '((foo . ((bar . baz))))) > "{\"foo\":{\"bar\":\"baz\"}}" > (clouchdb::document-to-json '((foo . ((bar . baz))))) > "[[\"FOO\",[\"BAR\",]]]" > > Is this intendend? Yes and no. It's intentionally different from the json output, but it probably shouldn't be losing baz. document-to-json is intentionally different from the json function because there were cases where it was impossible to tell the difference between a map and a list of one element. I'll see if I can fix this issue, but in the mean time note that the document creation will work if you use keyword symbols for field names: (create-document '((:name . "Hi there2") (:content . ((foo . "bar") (bla . "fasel"))) (:nested . ((:foo . ((:bla . ((:fasel . "zort"))))))) :id "hithere2") - Peter