Reputation: 984
By mistake I named it "createCollection" and now when I try to drop this collection it says
[thread1] TypeError: db.createCollection.drop is not a function : @(shell):1:1
How can I solve this?
Upvotes: 0
Views: 43
Reputation: 15629
If you name a collection like a keyword, you cant directly use it like db.collectionName
. Instead, you have to first retrive the collection with getCollection
and call the method on the returned object.
db.getCollection('createCollection').drop()
That's also the way to go, if you want to query a GridFS table directly.
db.getCollection('collectionName.chunks').find()
Upvotes: 1