[clouchdb-devel] problem to retrieve document versions

Peter Eddy peter.eddy at gmail.com
Thu Jun 5 17:37:31 UTC 2008


On Thu, Jun 5, 2008 at 12:34 PM, Nicolas Lamirault <nlamirault at gmail.com> 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
>



More information about the clouchdb-devel mailing list