Unable to access the collection from the shell - SyntaxError: missing; before statement (shell): 1

I wrote a script that uses mongoimport to upload csv files to mongodb. When I run this for two similar csv files (of the same type), both load fine, however I can only access one of them from the mongodb shell. Here is the mongodb shell session script:

> show collections 3mLgQAYJCq6_20110802 eTByWMY7zO6_20110802NonUniCode system.indexes > db.3mLgQAYJCq6_20110802 Thu Aug 18 18:44:49 SyntaxError: missing ; before statement (shell):1 > db.eTByWMY7zO6_20110802NonUniCode vh.eTByWMY7zO6_20110802NonUniCode 

However, I can access both collections from a python script and use mongoexport. I suspect there is a problem with the 3mLgQAYJCq6_20110802 file, but I do not know where to start looking. Any ideas?

+8
mongodb
source share
3 answers

This works for me when my collection names include special characters:

 db["3mLgQAYJCq6_20110802"].findOne(); 
+9
source share

The collection name must begin with a letter or underscore. You can get naming information for collections in mongodb from the link below - http://www.mongodb.org/display/DOCS/Collections

+3
source share

beautiful collection names ... maybe because it starts with 3 .

-one
source share

All Articles