1 ! Copyright (C) 2009 Your name.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs help.markup help.syntax kernel quotations ;
8 { "name" "name of the collection" }
9 { "collection" "mdb-collection instance" }
11 { $description "Creates a new mdb-collection instance. Use this to create capped/limited collections. See also: " { $link mdb-collection } }
13 { $example "! creates a mdb-collection instance capped to a maximum of 1000000 entries"
14 "\"mycollection\" <mdb-collection> t >>capped 1000000 >>max" } } ;
18 { "db" "name of the database to use" }
19 { "host" "host name or IP address" }
20 { "port" "port number" }
21 { "mdb" "mdb-db instance" }
23 { $description "Create a new mdb-db instance and automatically resolves master/slave information in a paired MongoDB setup." }
25 { $example "\"db\" \"127.0.0.1\" 27017 <mdb>" } } ;
29 { "collection" "collection to query" }
30 { "assoc" "query assoc" }
31 { "mdb-query-msg" "mdb-query-msg instance" }
33 { $description "Creates a new mdb-query-msg instance. "
34 "This word must be called from within a with-db scope."
38 { $example "\"mycollection\" H{ } <query>" } } ;
42 { "collection" "collection to update" }
43 { "selector" "selector assoc (selects which object(s) to update" }
44 { "object" "updated object or update instruction" }
45 { "mdb-update-msg" "mdb-update-msg instance" }
47 { $description "Creates an update message for the object(s) identified by the given selector."
48 "MongoDB supports full object updates as well as partial update modifiers such as $set, $inc or $push"
49 "For more information see: " { $url "http://www.mongodb.org/display/DOCS/Updates" } } ;
53 { "mdb-update-msg" "a mdb-update-msg" }
54 { "mdb-update-msg" "mdb-update-msg with the upsert indicator set to t" }
56 { $description "Marks a mdb-update-msg as upsert operation"
57 "(inserts object identified by the update selector if it doesn't exist in the collection)" } ;
61 { "value" "partial?" }
63 { $description "key which refers to a partially loaded object" } ;
68 { "spec" "sort spec" }
70 { $description "indicates that the values of the specified key should be sorted in ascending order" } ;
74 { "mdb-query-msg" "query" }
75 { "result" "number of objects in the collection that match the query" }
77 { $description "count objects in a collection" } ;
79 HELP: create-collection
81 { "name" "collection name" }
83 { $description "Creates a new collection with the given name." } ;
87 { "collection" "a collection" }
88 { "selector" "assoc which identifies the objects to be removed from the collection" }
90 { $description "removes objects from the collection (with lasterror check)" } ;
94 { "collection" "a collection" }
95 { "selector" "assoc which identifies the objects to be removed from the collection" }
97 { $description "removes objects from the collection (without error check)" } ;
102 { "spec" "sort spec" }
104 { $description "indicates that the values of the specified key should be sorted in descending order" } ;
106 HELP: drop-collection
108 { "name" "a collection" }
110 { $description "removes the collection and all objects in it from the database" } ;
114 { "collection" "a collection" }
115 { "name" "an index name" }
117 { $description "drops the specified index from the collection" } ;
119 HELP: ensure-collection
121 { "collection" "a collection; e.g. mycollection " }
122 { "fq-collection" "full qualified collection name; e.g. db.mycollection" }
124 { $description "ensures that the collection exists in the database and returns its full qualified name" } ;
128 { "collection" "a collection" }
129 { "name" "index name" }
130 { "spec" "index spec" }
132 { $description "Ensures the existence of the given index. "
133 "For more information on MongoDB indexes see: " { $url "http://www.mongodb.org/display/DOCS/Indexes" } }
135 { $example "\"mycollection\" nameIdx [ \"name\" asc ] keyspec <index-spec> ensure-index" }
136 { $example "\"mycollection\" nameIdx [ \"name\" asc ] keyspec <index-spec> unique-index ensure-index" } } ;
140 { "mdb-query-msg" "a query message" }
142 { $description "Prints the execution plan for the given query" } ;
146 { "mdb-query" "a query" }
147 { "cursor" "a cursor (if there are more results) or f" }
148 { "result" "a sequences of objects" }
150 { $description "executes the given query" }
152 { $example "\"mycollection\" H{ { \"name\" \"Alfred\" } } <query> find " } } ;
156 { "mdb-query" "a query" }
157 { "result" "a single object or f" }
159 { $description "Executes the query and returns one object at most" } ;
163 { "mdb-query" "a query" }
164 { "index-hint" "a hint to an index" }
165 { "mdb-query" "modified query object" }
167 { $description "Annotates the query with a hint to an index. "
168 "For detailed information see: " { $url "http://www.mongodb.org/display/DOCS/Optimizing+Mongo+Performance#OptimizingMongoPerformance-Hint" } }
170 { $example "\"mycollection\" H{ { \"name\" \"Alfred\" } { \"age\" 70 } } <query> H{ { \"name\" 1 } } hint find" } } ;
175 { "error" "error message or f" }
177 { $description "Checks if the last operation resulted in an error on the MongoDB side"
178 "For more information see: " { $url "http://www.mongodb.org/display/DOCS/Mongo+Commands#MongoCommands-LastErrorCommands" } } ;
182 { "mdb-query" "a query" }
183 { "limit#" "number of objects that should be returned at most" }
184 { "mdb-query" "modified query object" }
186 { $description "Limits the number of returned objects to limit#" }
188 { $example "\"mycollection\" H{ } <query> 10 limit find" } } ;
190 HELP: load-collection-list
193 { "collection-list" "list of collections in the current database" }
195 { $description "Returns a list of all collections that exist in the current database" } ;
197 HELP: load-index-list
200 { "index-list" "list of indexes" }
202 { $description "Returns a list of all indexes that exist in the current database" } ;
205 { $var-description "" } ;
208 { $var-description "" } ;
212 { "msg" "error message" }
214 { $description "" } ;
221 { $description "" } ;
225 { "collection" "a collection" }
228 { $description "Saves the object to the given collection."
229 " If the object contains a field name \"_id\" this command automatically performs an update (with upsert) instead of a plain save" } ;
233 { "collection" null }
236 { $description "" } ;
244 { $description "" } ;
252 { $description "" } ;
256 { "mdb-update-msg" null }
258 { $description "" } ;
262 { "mdb-update-msg" null }
264 { $description "" } ;
268 { "collection" null }
270 { $description "" } ;
277 { $description "" } ;
279 ARTICLE: "mongodb.driver" "mongodb.driver"
280 { $vocab-link "mongodb.driver" }
283 ABOUT: "mongodb.driver"