mongo.gridfs.store.file: Store a file into a GridFS on a MongoDB server

Description Usage Arguments Value See Also Examples

View source: R/gridfs.R

Description

Store a file into a GridFS on a MongoDB server. This function stores the entire given file on the server, breaking it up into 256K chunks as necessary.

Usage

1
mongo.gridfs.store.file(gridfs, filename, remotename = "", contenttype = "")

Arguments

gridfs

A (mongo.gridfs) object.

filename

(string) The path/filename of the file to copy to the server.

remotename

(string) The name the file will be known as within the GridFS.
If remotename=="" (the default), the remote file will be known by the given filename.

contenttype

(string) Optional MIME content type.

Value

TRUE, if successful; FALSE, if an error occured during the operation.

See Also

mongo.gridfs,
mongo.gridfs.create,
mongo.gridfs.remove.file.

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.