From 208620336f58d93c3e5fbf00e565c4db9f7e9564 Mon Sep 17 00:00:00 2001 From: Sascha Matzke Date: Wed, 4 Mar 2009 06:59:40 +0100 Subject: [PATCH] added a short example to README.txt --- README.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.txt b/README.txt index bb91f56c33..467e8581fc 100644 --- a/README.txt +++ b/README.txt @@ -1,2 +1,27 @@ This is the attempt to implement a driver for MongoDB (http://www.mongodb.org) in Factor (http://www.factorcode.org). + +Usage example (for a quick overview): + +USE: mongodb.driver + +! 1. initialize mdb +! database host port +"db" "127.0.0.1" 27017 + +! 2. create an index +! [ collection name spec ensure-index ] with-db +dup [ "test" "idIdx" H{ { "_id" 1 } } ensure-index ] with-db + +! 3. insert an object +! [ collection object save ] with-db +dup [ "test" H{ { "_id" "12345" } { "name" "myobject" } } save ] with-db + +! 4. find the object +! [ collection example ..options.. find ] with-db +dup [ "test" H{ { "_id" "12345" } } find ] with-db + +! a find with options would look like this + +dup [ "test" H{ { "name" "myobject" } } 10 limit + [ "_id" asc "name" desc ] sort find ] with-db