michaelbinks
michaelbinks

Reputation: 370

MongoDB drop collection, name start with backquote

There is a collection in my MongoDB that im not able to drop. The name of the collection ends with a ` (backquote) character and I got error when executing the drop command.

db.MyCollection`.drop()

Error is

2017-12-07T07:42:35.711+0000 SyntaxError: Unexpected token ILLEGAL

Is there any other way of removing or is it here forever?

Upvotes: 0

Views: 128

Answers (1)

Neodan
Neodan

Reputation: 5252

Just use getCollection function.

Example:

db.getCollection("MyCollection`").drop();

Upvotes: 3

Related Questions