From 143c02940402ed46d5def2f00855bdced6793193 Mon Sep 17 00:00:00 2001 From: Eduardo Sorribas Date: Fri, 30 Aug 2013 01:42:53 -0400 Subject: [PATCH] Add docs for runCommand() --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 0e115df..6249a7d 100644 --- a/README.md +++ b/README.md @@ -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