Skip to content

Commit

Permalink
Extend examples to include index creation.
Browse files Browse the repository at this point in the history
BUGZID:
  • Loading branch information
lehenbauer committed Feb 13, 2014
1 parent 5319e16 commit 221a3f6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
``

0 comments on commit 221a3f6

Please sign in to comment.