[clouchdb-cvs] CVS clouchdb/src
peddy
peddy at common-lisp.net
Sat Jun 27 00:51:45 UTC 2009
Update of /project/clouchdb/cvsroot/clouchdb/src
In directory cl-net:/tmp/cvs-serv19775
Modified Files:
clouchdb.lisp
Log Message:
Add copy-document and all-docs-by-seq
--- /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp 2009/06/06 18:37:10 1.33
+++ /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp 2009/06/27 00:51:42 1.34
@@ -654,6 +654,27 @@
(put-document doc :id id :attachments attachments)
(post-document doc)))
+(defun copy-document (from-id to-id &key revision)
+ "Copy one document to another document. If the destination already
+exists, and the intention is to overwrite the destination, then the
+revision parameter must be specified and must be the revision of the
+destination document."
+ (let ((id (if revision (cat to-id "?rev=" revision) to-id)))
+ (ensure-db ()
+ (db-request (cat (url-encode *db-name*) "/"
+ (url-encode from-id))
+ :content-type "text/plain"
+ :external-format-out +utf-8+
+ :content-length nil
+ :method :copy
+ :additional-headers `(("Destination" . ,id))))))
+
+(defun all-docs-by-seq ()
+ "See all documents that were updated and deleted, in the order these
+actions are done."
+ (ensure-db ()
+ (db-request (cat (url-encode *db-name*) "/_all_docs_by_seq"))))
+
(defun as-deleted-document (doc)
"Return specified document in a special document format used by
bulk-document-update to indicate that the document should be deleted
More information about the clouchdb-cvs
mailing list