I have created a collection in a database using mongo in c# . Iam able to delete the content in the collection using ID but not the collection .Pls help me how to drop a collection using c#
There's not much to it, just call Drop()
on the collection:
var test = db.GetCollection("test");
test.Drop();
Update: The new C# API way of doing this is:
db.DropCollection("test");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With