Learn R Programming

rmongodb (version 1.8.0)

mongo.gridfile: The mongo.gridfile class

Description

Objects of class "mongo.gridfile" are used to access gridfiles on a MongoDB server. They are created by mongo.gridfs.find().

Arguments

Details

mongo.gridfile objects have "mongo.gridfile" as their class and contain an externally managed pointer to the actual data used to manage operations on the gridfile. This pointer is stored in the "mongo.gridfile" attribute of the object. The object also has a "mongo.gridfs" attribute holding a pointer to the mongo.gridfs object used in creation to prevent garbage collection on the mongo.gridfs object while the mongo.gridfile is still active.

See Also

mongo.gridfs, mongo.gridfs.find, mongo.gridfile.get.filename, mongo.gridfile.get.descriptor, mongo.gridfile.get.filename, mongo.gridfile.get.length, mongo.gridfile.get.chunk.size, mongo.gridfile.get.chunk.count, mongo.gridfile.get.content.type, mongo.gridfile.get.upload.date, mongo.gridfile.get.md5, mongo.gridfile.get.metadata, mongo.gridfile.get.chunk, mongo.gridfile.get.chunks, mongo.gridfile.read, mongo.gridfile.seek, mongo.gridfile.pipe.

Examples

Run this code
mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
    gridfs <- mongo.gridfs.create(mongo, "grid")
    mongo.gridfs.store.file(gridfs, "tests/test.R", "test.R")

    gf <- mongo.gridfs.find(gridfs, "test.R")
    if( !is.null(gf)){
        gf
        mongo.gridfile.destroy(gf)
    }
    mongo.gridfs.destroy(gridfs)
}

Run the code above in your browser using DataLab