GridFS is used to store and retrieve files in BSON format whose size is greater than 16MB. It helps sync the files in the system with metadata. Also, it allows one to access some portion of the data in a file without loading the entire file. In GridFS, the data is stored in the form of collections. Chunks are a collection that stores binary data, while files are a collection that stores metadata. GridFS also uses indices for faster search and retrieval of data. It also supports sharding, i.e., replicating and distributing the partitioned tables across multiple machines, thus improving performance.