]> gitweb.factorcode.org Git - factor.git/commitdiff
fix doc typo and example error
authorSascha Matzke <sascha.matzke@didolo.org>
Fri, 4 Jun 2010 17:00:42 +0000 (19:00 +0200)
committerSascha Matzke <sascha.matzke@didolo.org>
Sat, 5 Jun 2010 09:52:41 +0000 (11:52 +0200)
extra/bson/reader/reader.factor
extra/mongodb/mongodb-docs.factor
extra/mongodb/operations/operations.factor
extra/mongodb/tuple/persistent/persistent.factor
extra/mongodb/tuple/tuple.factor

index 39cd5a9c93f0f0707fa5023958c1cd84f98e872a..e0cf0bc4f46c81353cf019931516c0c1167e833b 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2010 Sascha Matzke.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs bson.constants calendar combinators
-combinators.short-circuit io io.binary kernel math
+combinators.short-circuit io io.binary kernel math locals
 namespaces sequences serialize strings vectors byte-arrays ;
 
 FROM: io.encodings.binary => binary ;
@@ -68,8 +68,7 @@ TYPED: peek-scope ( state: state -- ht )
 
 : bson-object-data-read ( -- object )
     read-int32 drop get-state 
-    [ exemplar>> clone ] [ scope>> ] bi
-    [ push ] keep ; inline
+    [ exemplar>> clone dup ] [ scope>> ] bi push ; inline
 
 : bson-binary-read ( -- binary )
    read-int32 read-byte 
@@ -136,9 +135,9 @@ TYPED: (prepare-result) ( scope: vector element: element -- result )
 TYPED: (prepare-object) ( type: integer -- object )
     [ element-data-read ] [ end-element ] bi ; inline
 
-TYPED: (read-object) ( type: integer name: string state: state -- )
-    [ (prepare-object) ] 2dip
-    peek-scope set-at ; inline
+:: (read-object) ( type name state -- )
+    state peek-scope :> scope
+    type (prepare-object) name scope set-at ; inline
 
 TYPED: bson-not-eoo-element-read ( type: integer -- cont?: boolean )
     read-cstring get-state
index afdb2777fd6c782eab46dadcd2cd69e1ba30d0fc..6bddc2f496ec08a0d9f61adafb8c064b16b1ca2b 100644 (file)
@@ -9,7 +9,7 @@ ARTICLE: "mongodb" "MongoDB factor integration"
   "USING: mongodb.driver ;"
   "\"db\" \"127.0.0.1\" 27017 <mdb>"
   "[ \"mycollection\" [ H{ { \"name\" \"Alfred\" } { \"age\" 57 } } save ] "
-  "                 [ ageIdx [ \"age\" asc ] key-spec <index-spec> ensure-index ]"
+  "                 [ \"ageIdx\" [ \"age\" asc ] key-spec <index-spec> ensure-index ]"
   "                 [ H{ { \"age\" H{ { \"$gt\" 50 } } } } <query> find-one ] tri ] with-db "
   "" }
 { $heading "Highlevel tuple integration" }
index a95223929a8e35f2be14fc698a63d3fa129d5573..7d16b4c40aafca724c18562520cb85c6b4030c4e 100644 (file)
@@ -52,7 +52,7 @@ SYMBOL: msg-bytes-read
     read-longlong >>cursor
     read-int32 >>start#
     read-int32 [ >>returned# ] keep
-    [ H{ } stream>assoc ] collector [ times ] dip >>objects ;    
+    [ H{ } clone stream>assoc ] collector [ times ] dip >>objects ;    
 
 : (read-message) ( message opcode -- message )
     OP_Reply = 
index 625341a211297017e5963f9f127d8ce335c7d9da..bc6a6c0f8012cac13f690ca40e4a7338b0ac387c 100644 (file)
@@ -42,7 +42,7 @@ DEFER: assoc>tuple
    swap set-at ; inline
 
 : write-field? ( tuple key value -- ? )
-   pick mdb-persistent? [ 
+   pick mdb-persistent? [
       { [ [ 2drop ] dip not ]
         [ drop transient-slot? ] } 3|| not ] [ 3drop t ] if ; inline
 
index ce76a37ff4a3fa248b98ab3faa9de3510b301293..df5a541f6659fde655e4bc1a1050f5b828093d69 100644 (file)
@@ -63,7 +63,7 @@ PRIVATE>
     [ tuple-collection name>> ]
     [ id-selector ]
     [ tuple>assoc ] tri
-    <update> update ;
+    <update> >upsert update ;
 
 : save-tuple ( tuple -- )
     update-tuple ;