All three Studio 3T editions support GridFS, the method MongoDB uses to store files larger than the document size limit of 16 MB. Try it today.
MongoDB and GridFS
GridFS is the file abstraction method MongoDB uses to store and retrieve files larger than 16 MB.
GridFS divides large files into equal chunks with a default size of 255 kB and stores them as a separate document. The last chunk, however, can be as large as necessary.
MongoDB creates two collections to store the files. The first collection –
chunks – contains the file chunks; the second –
files – contains the file metadata. When you search GridDS for a file, the driver will reassemble the chunks as needed.
GridFS is a fitting mechanism to store files in MongoDB, which complements the schema-less (hence faster) retrieval of information provided by the document model.
Because files are divided into smaller chunks, it’s easier to access specific sections of a file, sparing the memory-expensive task of loading an entire file.
GridFS Support in Studio 3T
In Studio 3T, each database has a corresponding GridFS Buckets folder.
Within this folder is a default bucket called Images, but you can add more buckets as needed.
Add a new GridFS bucket
- Right-click on the GridFS Buckets folder.
- Choose Add Bucket.
- Name your bucket.
- Click OK.
Drop a GridFS bucket
- Right-click on the bucket to be deleted.
- Choose Drop Bucket.
Open GridFS view
- Right-click – Right-click on the target GridFS bucket and choose Open GridFS view.
- Hotkey – Choose the bucket to view and press Enter
Add a new file
- Right-click – Right-click anywhere within the GridFS view and choose Add Files.
- Button – Click on the green + sign in the toolbar.
Delete a file
- Right-click – Right-click on the file to be deleted and choose Remove file(s).
- Button – Click on the red – sign in the toolbar.
- Hotkey – ⌫ (fn + ⌫ on Mac)
Save a file
- Right-click – Right-click on the file you want to save and choose Save to Disk.
- Button – Click on the disk icon in the toolbar.
- Hotkey – Ctrl + S (⌘ + S)
View a file
- Right-click – Right-click on the file you want to view and choose View File.
- Button – Choose the file you want to view and click on the lens icon in the toolbar.
- Hotkey – F3 (fn + F3 on Mac) [/ht_toggle]
Search for files
1. Define the search parameter in the drop-down. Choose from:
- File search
- ID search
- Type search
- Uploaded before
- Uploaded after
- File size smaller
- File size larger
- MD5 search
2. Type in the value to look for in the search bar.
3. Define the sort parameter. Choose from:
- No sort
- File Name
- File ID
- File Type
- Upload Date
4. Click on the Play button to run the search.
View the GridFS collections
Each GridFS bucket creates two corresponding collections: BucketName.chunks and BucketName.files.
BucketName.chunks contains the actual file chunks:
While BucketName.files contains the file metadata like filename, uploadDate, and contentType: