Learn R Programming

rmongodb (version 1.8.0)

mongo.simple.command: Issue a simple.command to a database on MongoDB server

Description

Issue a simple command to a MongoDB server and return the response from the server.

Usage

mongo.simple.command(mongo, db, cmdstr, arg)

Arguments

mongo
(mongo) A mongo connection object.
db
(string) The name of the database upon which to perform the command.
cmdstr
(string) The name of the command.
arg
An argument to the command, may be a string or numeric (as.integer).

Value

NULL if the command failed. Use mongo.get.last.err() to determine the cause.(mongo.bson) The server's response if successful.

Details

This function supports many of the MongoDB database commands by allowing you to specify a simple command object which is entirely specified by the command name and an integer or string argument.

See http://www.mongodb.org/display/DOCS/List+of+Database+Commands.

See Also

mongo.command, mongo.rename, mongo.count, mongo.drop.database, mongo.drop, mongo, mongo.bson.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    print(mongo.simple.command(mongo, "admin", "buildInfo", 1))

    mongo.destroy(mongo)
}

Run the code above in your browser using DataLab