]> gitweb.factorcode.org Git - factor.git/blob - extra/mongodb/mongodb-docs.factor
factor: trim using lists
[factor.git] / extra / mongodb / mongodb-docs.factor
1 USING: help.markup help.syntax ;
2 IN: mongodb
3
4 ARTICLE: "mongodb" "MongoDB factor integration"
5 "The " { $vocab-link "mongodb" } " vocabulary provides two different interfaces to the MongoDB document-oriented database"
6 { $heading "Low-level driver" }
7 "The " { $vocab-link "mongodb.driver" } " vocabulary provides a low-level interface to MongoDB."
8 { $unchecked-example
9   "USING: mongodb.driver ;"
10   "\"db\" \"127.0.0.1\" 27017 <mdb>"
11   "[ \"mycollection\" [ H{ { \"name\" \"Alfred\" } { \"age\" 57 } } save ] "
12   "                 [ \"ageIdx\" [ \"age\" asc ] key-spec <index-spec> ensure-index ]"
13   "                 [ H{ { \"age\" H{ { \"$gt\" 50 } } } } <query> find-one ] tri ] with-db "
14   "" }
15 { $heading "Highlevel tuple integration" }
16 "The " { $vocab-link "mongodb.tuple" } " vocabulary lets you define persistent tuples that can be stored to and retrieved from a MongoDB database"
17 { $unchecked-example
18   "USING: mongodb.driver mongodb.tuple fry literals ;"
19   "MDBTUPLE: person name age ; "
20   "person \"persons\" { } { $[ \"ageIdx\" [ \"age\" asc ] key-spec <tuple-index> ] } define-persistent "
21   "\"db\" \"127.0.0.1\" 27017 <mdb>"
22   "person new \"Alfred\" >>name 57 >>age"
23   "'[ person ensure-table _ save-tuple person new 57 >>age select-tuple ] with-db"
24   "" }
25 ;
26
27 ABOUT: "mongodb"