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

Description Usage Arguments Value See Also Examples

View source: R/gridfs.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
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)
}

jonkatz2/rmongodb documentation built on May 19, 2019, 7:30 p.m.