Can you please help me with the below queries regarding Grid FS documentation.
Reference : https://docs.mongodb.com/drivers/java/sync/current/fundamentals/gridfs/
GridFSBucket.create() willcreate the chunks and files collection on first file upload. Which one among the two collections will be created first, fs.chunks or fs.files ?
If there is failure while creating or deleting the file. The orphan chunks must be manually cleared (using 4.2v). How can it be efficiently done without scanning the entire bucket by mapping the file_id in chunks and files collection.
2.1. If $lookup is only the option to join. How do I determine which collection to run aggregate ? This again relates to question (1) to identify which collection is updated first by MongoDB.
GridFsBucket.delete(file_id) → does it run a cascade delete on both files and chunks collection ?