Learn R Programming

rmongodb (version 1.8.0)

mongo: The mongo (database connection) class

Description

Objects of class "mongo" are used to connect to a MongoDB server and to perform database operations on that server.

Arguments

Details

mongo objects have "mongo" as their class and contain an externally managed pointer to the connection data. This pointer is stored in the "mongo" attribute of the object.

Note that the members of the mongo object only reflect the initial parameters of mongo.create(). Only the external data actually changes if, for example, mongo.timeout is called after the initial call to mongo.create.

See Also

mongo.create, mongo.is.connected, mongo.get.databases, mongo.get.database.collections, mongo.insert, mongo.find.one, mongo.find, mongo.update, mongo.remove, mongo.drop, mongo.drop.database mongo.gridfs.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    buf <- mongo.bson.buffer.create()
    mongo.bson.buffer.append(buf, "name", "Joe")
    mongo.bson.buffer.append(buf, "age", 22L)
    b <- mongo.bson.from.buffer(buf)
    mongo.insert(mongo, "test.people", b)
}

Run the code above in your browser using DataLab