2009-05-01 13:34:04 -04:00
|
|
|
USING: assocs help.markup help.syntax kernel quotations ;
|
|
|
|
IN: mongodb
|
|
|
|
|
|
|
|
ARTICLE: "mongodb" "MongoDB factor integration"
|
|
|
|
"The " { $vocab-link "mongodb" } " vocabulary provides two different interfaces to the MongoDB document-oriented database"
|
|
|
|
{ $heading "Low-level driver" }
|
|
|
|
"The " { $vocab-link "mongodb.driver" } " vocabulary provides a low-level interface to MongoDB."
|
|
|
|
{ $unchecked-example
|
|
|
|
"USING: mongodb.driver ;"
|
|
|
|
"\"db\" \"127.0.0.1\" 27017 <mdb>"
|
|
|
|
"[ \"mycollection\" [ H{ { \"name\" \"Alfred\" } { \"age\" 57 } } save ] "
|
2010-06-04 13:00:42 -04:00
|
|
|
" [ \"ageIdx\" [ \"age\" asc ] key-spec <index-spec> ensure-index ]"
|
2009-05-01 13:34:04 -04:00
|
|
|
" [ H{ { \"age\" H{ { \"$gt\" 50 } } } } <query> find-one ] tri ] with-db "
|
|
|
|
"" }
|
|
|
|
{ $heading "Highlevel tuple integration" }
|
|
|
|
"The " { $vocab-link "mongodb.tuple" } " vocabulary lets you define persistent tuples that can be stored to and retrieved from a MongoDB database"
|
|
|
|
{ $unchecked-example
|
2009-05-04 08:16:42 -04:00
|
|
|
"USING: mongodb.driver mongodb.tuple fry literals ;"
|
2009-05-01 13:34:04 -04:00
|
|
|
"MDBTUPLE: person name age ; "
|
2009-05-04 08:16:42 -04:00
|
|
|
"person \"persons\" { } { $[ \"ageIdx\" [ \"age\" asc ] key-spec <tuple-index> ] } define-persistent "
|
2009-05-01 13:34:04 -04:00
|
|
|
"\"db\" \"127.0.0.1\" 27017 <mdb>"
|
|
|
|
"person new \"Alfred\" >>name 57 >>age"
|
2010-07-31 04:48:49 -04:00
|
|
|
"'[ person ensure-table _ save-tuple person new 57 >>age select-tuple ] with-db"
|
2009-05-01 13:34:04 -04:00
|
|
|
"" }
|
|
|
|
;
|
|
|
|
|
2015-07-02 13:31:22 -04:00
|
|
|
ABOUT: "mongodb"
|