fix doc typo and example error
parent
8f7516d614
commit
bd5b798942
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2010 Sascha Matzke.
|
! Copyright (C) 2010 Sascha Matzke.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs bson.constants calendar combinators
|
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 ;
|
namespaces sequences serialize strings vectors byte-arrays ;
|
||||||
|
|
||||||
FROM: io.encodings.binary => binary ;
|
FROM: io.encodings.binary => binary ;
|
||||||
|
@ -68,8 +68,7 @@ TYPED: peek-scope ( state: state -- ht )
|
||||||
|
|
||||||
: bson-object-data-read ( -- object )
|
: bson-object-data-read ( -- object )
|
||||||
read-int32 drop get-state
|
read-int32 drop get-state
|
||||||
[ exemplar>> clone ] [ scope>> ] bi
|
[ exemplar>> clone dup ] [ scope>> ] bi push ; inline
|
||||||
[ push ] keep ; inline
|
|
||||||
|
|
||||||
: bson-binary-read ( -- binary )
|
: bson-binary-read ( -- binary )
|
||||||
read-int32 read-byte
|
read-int32 read-byte
|
||||||
|
@ -136,9 +135,9 @@ TYPED: (prepare-result) ( scope: vector element: element -- result )
|
||||||
TYPED: (prepare-object) ( type: integer -- object )
|
TYPED: (prepare-object) ( type: integer -- object )
|
||||||
[ element-data-read ] [ end-element ] bi ; inline
|
[ element-data-read ] [ end-element ] bi ; inline
|
||||||
|
|
||||||
TYPED: (read-object) ( type: integer name: string state: state -- )
|
:: (read-object) ( type name state -- )
|
||||||
[ (prepare-object) ] 2dip
|
state peek-scope :> scope
|
||||||
peek-scope set-at ; inline
|
type (prepare-object) name scope set-at ; inline
|
||||||
|
|
||||||
TYPED: bson-not-eoo-element-read ( type: integer -- cont?: boolean )
|
TYPED: bson-not-eoo-element-read ( type: integer -- cont?: boolean )
|
||||||
read-cstring get-state
|
read-cstring get-state
|
||||||
|
|
|
@ -9,7 +9,7 @@ ARTICLE: "mongodb" "MongoDB factor integration"
|
||||||
"USING: mongodb.driver ;"
|
"USING: mongodb.driver ;"
|
||||||
"\"db\" \"127.0.0.1\" 27017 <mdb>"
|
"\"db\" \"127.0.0.1\" 27017 <mdb>"
|
||||||
"[ \"mycollection\" [ H{ { \"name\" \"Alfred\" } { \"age\" 57 } } save ] "
|
"[ \"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 "
|
" [ H{ { \"age\" H{ { \"$gt\" 50 } } } } <query> find-one ] tri ] with-db "
|
||||||
"" }
|
"" }
|
||||||
{ $heading "Highlevel tuple integration" }
|
{ $heading "Highlevel tuple integration" }
|
||||||
|
|
|
@ -52,7 +52,7 @@ SYMBOL: msg-bytes-read
|
||||||
read-longlong >>cursor
|
read-longlong >>cursor
|
||||||
read-int32 >>start#
|
read-int32 >>start#
|
||||||
read-int32 [ >>returned# ] keep
|
read-int32 [ >>returned# ] keep
|
||||||
[ H{ } stream>assoc ] collector [ times ] dip >>objects ;
|
[ H{ } clone stream>assoc ] collector [ times ] dip >>objects ;
|
||||||
|
|
||||||
: (read-message) ( message opcode -- message )
|
: (read-message) ( message opcode -- message )
|
||||||
OP_Reply =
|
OP_Reply =
|
||||||
|
|
|
@ -42,7 +42,7 @@ DEFER: assoc>tuple
|
||||||
swap set-at ; inline
|
swap set-at ; inline
|
||||||
|
|
||||||
: write-field? ( tuple key value -- ? )
|
: write-field? ( tuple key value -- ? )
|
||||||
pick mdb-persistent? [
|
pick mdb-persistent? [
|
||||||
{ [ [ 2drop ] dip not ]
|
{ [ [ 2drop ] dip not ]
|
||||||
[ drop transient-slot? ] } 3|| not ] [ 3drop t ] if ; inline
|
[ drop transient-slot? ] } 3|| not ] [ 3drop t ] if ; inline
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ PRIVATE>
|
||||||
[ tuple-collection name>> ]
|
[ tuple-collection name>> ]
|
||||||
[ id-selector ]
|
[ id-selector ]
|
||||||
[ tuple>assoc ] tri
|
[ tuple>assoc ] tri
|
||||||
<update> update ;
|
<update> >upsert update ;
|
||||||
|
|
||||||
: save-tuple ( tuple -- )
|
: save-tuple ( tuple -- )
|
||||||
update-tuple ;
|
update-tuple ;
|
||||||
|
|
Loading…
Reference in New Issue