Numeric Collection Name Remove
Asked Answered
S

2

11

How can you drop a numeric collection from MongoDB?

PRIMARY> db.123456789011.remove({});
Tue Mar 20 08:42:51 SyntaxError: missing ; before statement (shell):1

PRIMARY> db.123456789011.drop({});
Tue Mar 20 08:43:13 SyntaxError: missing ; before statement (shell):1

Was created through a PHP script.. now I can't figure out how to remove this..

Thoughts?

Thank you

Stuccowork answered 20/3, 2012 at 15:43 Comment(0)
C
18

This should work:

   db["123456789011"].drop()
Chalco answered 20/3, 2012 at 15:50 Comment(0)
R
8

I was having the same issue with a collection generated by a java class

db["1234"].drop()
Wed Jul  9 14:57:39.358 TypeError: Cannot call method 'drop' of undefined

and at the end used the following command to remove it.

db.getCollection('1234').drop()
Rimma answered 9/7, 2014 at 14:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.