Shihan Rehman
Shihan Rehman

Reputation: 133

mongoDB clear documents in collection

Please help with error below when running in mongodDb shell, thanks,

> use mvp_demo
switched to db mvp_demo
> show collections;
1476851599865_IND_TRX
1476851599865_NIN_TRX
1476851599865_SWF_TRX
configuration
> db.1476851599865_IND_TRX.remove({})
2017-02-16T22:34:29.377-0500 E QUERY    [thread1] SyntaxError: identifier   starts immediately after numeric literal @(shell):1:2

Upvotes: 0

Views: 448

Answers (1)

Mohammad Ali
Mohammad Ali

Reputation: 922

The problem is that mongodb wasn't designed to have a number as the first character in a collection name, similar to how JavaScript doesn't let you begin a variable name with a number. But to get around this limitation please try running the following:

db["1476851599865_IND_TRX"].remove({})

Upvotes: 1

Related Questions