mongo.gridfile.pipe: Pipe a mongo.gridfile to an R connection

Description Usage Arguments See Also Examples

View source: R/gridfs.R

Description

Pipe a mongo.gridfile to an R connection. This outputs the entire GridFS file to a connection. If the connection is open, it must be in binary output mode; otherwise, the connection is opened in binary output mode and closed afterwards.

Usage

1
mongo.gridfile.pipe(gridfile, con)

Arguments

gridfile

A (mongo.gridfile) object.

con

(connection) An R connection object.

See Also

mongo.gridfs,
mongo.gridfs.find,
mongo.gridfile,
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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)) {
        f <- file("mongodb_copy.pdf")
        mongo.gridfile.pipe(gf, f)

        mongo.gridfile.destroy(gf)
    }

    mongo.gridfs.destroy(gridfs)
}

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