HungryPipo
HungryPipo

Reputation: 265

MongoDB GridFS - How to use mongofiles(or some other utility) to delete all files?

I would like to clean all the files from the GridFS of a particular Mongo database. The mongofiles command line utility has a delete function but I don't know how to tell it do delete "all files". I've been using MongoVue to select and delete the files in the fs view of GridFS but that only lets you delete specific number of selected files.

What I'm looking for is the SQL equivalent of Delete * FROM

Upvotes: 0

Views: 1286

Answers (1)

user3295173
user3295173

Reputation: 167

    db.fs.files.remove({})
    db.fs.chunks.remove({})
    db.repairDatabase()  (cleans out the memory)

running these commands should remove all files

Upvotes: 4

Related Questions