GridFS: Clean out all unreferenced files
问题 I have just moved towards storing things in my GridFS in MongoDB. During testing, I noticed many files are being created but not deleted properly. I have a collection users , which has a field avatar . It contains the ObjectId of the file. Now I'd like to have some command I could use to remove all the files and chunks that are not referenced there. Is it possible to do that with one query? Maybe 'map-reduce'? Also I am not sure how to properly delete GridFS-Files in node-mongodb-native