![]() Which returns the GridFSFindIterableĭelete() - Given a id, delete this stored file's files collection document and associated chunks from a GridFS bucket. UploadFromStream() - Uploads the contents of the given InputStream to a GridFS bucket.ĭownloadToStream() - Downloads the contents of the latest version of the stored file specified by filename and writes the contents to the destination Stream.įind() - Finds all documents in the files collection. ![]() GridFSBucket gridBucket = GridFSBuckets.create(database) MongoDatabase database = mongoClient.getDatabase("technicalkeeda") To create a GridFSBucket we will use GridFSBuckets factory class and it uses instance of a MongoDatabase. We are using GridFSBucket to deal with different operation of GridFS like upload, download and delete etc. To use the mongodb java driver, Define respected maven dependencies of mongo-java-driver in pom.xml The chunks collection stores the file chunks, and the files collection stores the file metadata Tools and Technologiesīasically we are using below maven dependencies GridFS uses two collections to store files. By default GridFS limits chunk size to 255k. Instead of storing a file in a single document, GridFS divides a file into parts, or chunks, and stores each of those chunks as a separate document. GridFS is a specification for storing and retrieving files that exceed the BSON-document size limit of 16MB.
0 Comments
Leave a Reply. |