| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
MongoDB.GridFS.GetFiles
Gets collection that contains the file metadata for GridFS.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| MongoDB | 16.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "MongoDB.GridFS.GetFiles"; MongoDBRef ) More
Parameters
| Parameter | Description | Example |
|---|---|---|
| MongoDBRef | The reference number for the mongo connection. | $MongoDB |
Result
Returns OK or error.
Description
Gets collection that contains the file metadata for GridFS.Use collection functions to work on that collection.
Examples
Show files collection:
Set Variable [ $r ; Value: MBS( "MongoDB.GridFS.Open"; $Mongo; "test" ) ]
If [ MBS("IsError") ]
Set Variable [ $x ; Value: MBS( "MongoDB.Release"; $Mongo ) ]
Show Custom Dialog [ "Failed to open gridfs." ; $r ]
Exit Script [ Text Result: ]
End If
#
# get files collection
Set Variable [ $r ; Value: MBS( "MongoDB.GridFS.GetFiles"; $Mongo) ]
If [ MBS("IsError") ]
Set Variable [ $x ; Value: MBS( "MongoDB.Release"; $Mongo ) ]
Show Custom Dialog [ "Failed to drop gridfs." ; $r ]
Exit Script [ Text Result: ]
End If
#
# find all in collection
Set Variable [ $r ; Value: MBS( "MongoDB.Find"; $Mongo; "{}") ]
# show all records
Show Custom Dialog [ "Files" ; MBS( "MongoDB.CursorRecords"; $mongo ) ]
If [ MBS("IsError") ]
Set Variable [ $x ; Value: MBS( "MongoDB.Release"; $Mongo ) ]
Show Custom Dialog [ "Failed to open gridfs." ; $r ]
Exit Script [ Text Result: ]
End If
#
# get files collection
Set Variable [ $r ; Value: MBS( "MongoDB.GridFS.GetFiles"; $Mongo) ]
If [ MBS("IsError") ]
Set Variable [ $x ; Value: MBS( "MongoDB.Release"; $Mongo ) ]
Show Custom Dialog [ "Failed to drop gridfs." ; $r ]
Exit Script [ Text Result: ]
End If
#
# find all in collection
Set Variable [ $r ; Value: MBS( "MongoDB.Find"; $Mongo; "{}") ]
# show all records
Show Custom Dialog [ "Files" ; MBS( "MongoDB.CursorRecords"; $mongo ) ]
See also
- IsError
- MongoDB.CursorRecords
- MongoDB.Find
- MongoDB.GridFS.GetChunks
- MongoDB.GridFS.Open
- MongoDB.GridFS.Remove
- MongoDB.Release
Release notes
- Version 16.3
- Added GridFS functions for MongoDB functions: MongoDB.GridFS.Close, MongoDB.GridFS.Drop, MongoDB.GridFS.Find, MongoDB.GridFS.FindOne, MongoDB.GridFS.FindOneByFileName, MongoDB.GridFS.GetChunks, MongoDB.GridFS.GetFiles, MongoDB.GridFS.Open, MongoDB.GridFS.Read, MongoDB.GridFS.Remove, MongoDB.GridFS.RemoveByFileName and MongoDB.GridFS.Write.
This function checks for a license.
Created 28th May 2026, last changed 28th May 2026