How to delete Mongodb collection using collection name in C #

I created a collection in a database using mongo in C #. I can delete contents in a collection using ID, but not with collection. Pls help me delete a collection using C #

+4
source share
1 answer

There are not many, just call Drop()in the collection:

var test = db.GetCollection("test");
test.Drop();

Refresh . New way to use C # API:

db.DropCollection("test");
+8
source

All Articles