From 221a3f6353ad47049a76dba37aeeed7cda48797e Mon Sep 17 00:00:00 2001 From: Karl Lehenbauer Date: Thu, 13 Feb 2014 21:14:41 +0000 Subject: [PATCH] Extend examples to include index creation. BUGZID: --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 38756a5..bd1cf8e 100755 --- a/README.md +++ b/README.md @@ -322,6 +322,8 @@ Set what fields are returned. bson is a bson object containing the fields. Exp Example --- +* create a bson object and insert it into a MongoDB database + ```tcl $bson init new_oid _id string "name" "Joe" int "age" 33 finish @@ -330,6 +332,25 @@ Example When you're done using the bson object, destroy it by doing a +```tcl rename $bson "" +``` When you're done using the mongodb object, destroy it similarly. + +* create an index on a MongoDB namespace + +```tcl + set keyBson [::mongo::bson create #auto] + $keyBson init int flight_id 1 finish + set resultBson [::mongo::bson create #auto] + $mongo create_index daystream.controlstream $keyBson $bsonResult +``` + +The bson result object can be examined for the status. + +To build the same index in the bacground, append the '''background''' option to the command: + +```tcl + $mongo create_index daystream.controlstream $keyBson $bsonResult background +``