From 1b381c4c16ecb9e4783949b5de6113750d29a25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Puente=20Sarr=C3=ADn?= Date: Thu, 9 May 2013 11:15:34 -0500 Subject: [PATCH] DOCS-1098 Fixed GridFS example using Java driver --- source/core/gridfs.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/source/core/gridfs.txt b/source/core/gridfs.txt index b1218f56f42..60591f602d6 100644 --- a/source/core/gridfs.txt +++ b/source/core/gridfs.txt @@ -115,19 +115,22 @@ By default, the interface must support the default GridFS bucket, named .. code-block:: java - // returns default GridFS bucket (e.g. "fs" collection) - GridFS myFS = new GridFS(myDatabase); + // returns default GridFS bucket (i.e. "fs" collection) + GridFS myFS = new GridFS(myDatabase); // saves the file to "fs" GridFS bucket - myFS.storeFile(new File("/tmp/largething.mpg")); + myFS.createFile(new File("/tmp/largething.mpg")); Optionally, interfaces may support other additional GridFS buckets as in the following example: .. code-block:: java - // returns GridFS bucket named "contracts" - GridFS myContracts = new GridFS(myDatabase, "contracts"); + // returns GridFS bucket named "contracts" + GridFS myContracts = new GridFS(myDatabase, "contracts"); // retrieve GridFS object "smithco" - myFS.retrieveFile("smithco", new File("/tmp/smithco.pdf")); + GridFSDBFile file = myContracts.findOne("smithco"); + + // saves the GridFS file to the file system + file.writeTo(new File("/tmp/smithco.pdf"));