rmongodb (version 1.8.0)

mongo.rename: Rename a collection on a MongoDB server

Description

Rename a collection on a MongoDB server.

Usage

mongo.rename(mongo, from.ns, to.ns)

Arguments

mongo
(mongo) A mongo connection object.
from.ns
(string) The namespace of the collection to rename.
to.ns
(string) The new namespace of the collection.

Value

TRUE if successful; otherwise, FALSE.

Details

Note that this may also be used to move a collection from one database to another.

See Also

mongo.drop.database, mongo.drop, mongo.command, mongo.count, mongo.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    print(mongo.rename(mongo, "test.people", "test.humans"))

    mongo.destroy(mongo)
}

Run the code above in your browser using DataLab