Reputation: 387
I create a collection in Mongodb with a name like "col", and it seems like with name contains character "", you cannot use db.COLLECTION_NAME.drop() to drop it??
the "_jihui" collection is what I'm referring to.
Upvotes: 0
Views: 108
Reputation: 1633
Use getCollection() method for that purpose:
db.getCollection('_col').drop()
Upvotes: 1
Reputation: 2650
you can enclose your collection name in square brackets when the collection contain some kind of special characters in its name.
eg : db["my-db--collection"].drop()
Upvotes: 0