Description Usage Arguments Value See Also Examples
Find a GridFS file and return a mongo.gridfile object used for further operations on it
1 | mongo.gridfs.find(gridfs, query)
|
gridfs |
A (mongo.gridfs) object. |
query |
(string) The name of the GridFS file to locate. This parameter may also be a mongo.bson query object and is used to
search the GridFS "files" collection documents for matches. Alternately,
|
NULL, if not found; otherwise, a mongo.gridfile object corresponding to the found GridFS file.
mongo.gridfile,
mongo.gridfile.get.filename
,
mongo.gridfs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
gridfs <- mongo.gridfs.create(mongo, "grid")
gf <- mongo.gridfs.find(gridfs, "test.dat")
print(mongo.gridfile.get.length(gf))
# find a GridFS file uploaded midnight July 4, 2008
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append(buf, "uploadDate",
strptime("07-04-2008", "%m-%d-%Y"))
query <- mongo.bson.from.buffer(buf)
gf <- mongo.gridfs.find(gridfs, query)
if (!is.null(gf))
print(mongo.gridfile.get.filename(gf))
mongo.gridfs.destroy(gridfs)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.