Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions source/core/gridfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"));