fix doc typo and example error

db4
Sascha Matzke 2010-06-04 19:00:42 +02:00
parent 8f7516d614
commit bd5b798942
5 changed files with 9 additions and 10 deletions

View 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

View 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" }

View 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 =

View File

@ -63,7 +63,7 @@ PRIVATE>
[ tuple-collection name>> ]
[ id-selector ]
[ tuple>assoc ] tri
<update> update ;
<update> >upsert update ;
: save-tuple ( tuple -- )
update-tuple ;