Learn R Programming

rmongodb (version 1.8.0)

mongo.gridfs.create: Create a mongo.gridfs object

Description

Create a mongo.gridfs object used to access and store "grid files" on the MongoDB server.

Usage

mongo.gridfs.create(mongo, db, prefix = "fs")

Arguments

mongo
A (mongo) connection object.
db
(string) The name of the database in which to access and/or store the gridfs-related collections.
prefix
(string) The prefix to use constructing the gridfs-related collection names. There are two collections used for this purpose: \"db.prefix.files\" and \"db.prefix.chunks\".

Value

(mongo.gridfs) An object to be used for subsequent operations on the grid file store.

See Also

mongo.gridfs, mongo.gridfs.destroy, mongo.gridfs.store.file, mongo.gridfs.remove.file, mongo.gridfs.store, mongo.gridfile.writer.create, mongo.gridfs.find, link{mongo.shorthand}.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    gridfs <- mongo.gridfs.create(mongo, "grid")
    # Copy a local file to the server as a gridfs file
    mongo.gridfs.store.file(gridfs, "tests/test.R", "test.R")
    mongo.gridfs.destroy(gridfs)
}

Run the code above in your browser using DataLab