Skip to content

Commit

Permalink
Add docs for runCommand()
Browse files Browse the repository at this point in the history
  • Loading branch information
sorribas committed Aug 30, 2013
1 parent 95af078 commit 143c029
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ cursor.on('data', function(doc) {

Note that you need to explicitly set the selection parameter in the `find` call.

## Database commands

With mongojs you can run database commands just like with the mongo shell using `db.runCommand()`

```js
db.runCommand({ping:1}, function(err, result) {
if(!err && result.ok) console.log("we're up");
});
```

or `db.collection.runCommand()`

```js
db.things.runCommand('count', {}, function(err, res) {
console.log(res);
});
```

## Replication Sets

Mongojs can also connect to a mongo replication set by providing a connection string with multiple hosts
Expand Down

0 comments on commit 143c029

Please sign in to comment.