[clouchdb-cvs] CVS clouchdb/public_html
peddy
peddy at common-lisp.net
Sat Jul 18 21:14:49 UTC 2009
Update of /project/clouchdb/cvsroot/clouchdb/public_html
In directory cl-net:/tmp/cvs-serv7350/public_html
Modified Files:
index.html
Log Message:
Add property list option to (document-property) and (setf (document-property))
--- /project/clouchdb/cvsroot/clouchdb/public_html/index.html 2009/07/17 00:26:33 1.9
+++ /project/clouchdb/cvsroot/clouchdb/public_html/index.html 2009/07/18 21:14:49 1.10
@@ -1237,15 +1237,26 @@
</p>
<blockquote>
<p>
-Get the value of the named document property or nil if property does
-not exist. This function can be used with setf to set property values
-as well:
+ Get the value of the named document property or nil if property does
+ not exist. This function can be used with setf to set property
+ values as well. The <b>name</b> parameter may be either a keyword
+ document property name or a list of such properties. If <b>name</b>
+ is a list, it specifies a nested property in the document starting
+ with the outermost property and proceeding to the most nested
+ property.
</p>
<pre class="code">
(create-document '((:name . "Maxwell Smart") (:agent . 86)) :id "max")
(document-property :name (get-document "max"))
<b>=></b> "Maxwell Smart"
+
+;; Nested property change example
+(create-document '((:a . 1)(:b . ((:c . ((:d . "New York")))))) :id "nested")
+;; Change (:d . "New York") to (:d . "Boston")
+(put-document
+ (setf (document-property '(:b :c :d) (get-document "nested")) "Boston"))
+
</pre>
<p>
See
More information about the clouchdb-cvs
mailing list