mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
gridfs <- mongo.gridfs.create(mongo, "grid")
# 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.gridfile.destroy(gf)
}
mongo.gridfs.destroy(gridfs)
}
Run the code above in your browser using DataLab