I have a web app, that accepts parameters that then go on to create a collection in mongodb. I’m currently doing some testing and using the interactive shell to find if the read and writes are correct. If I use a some character everything works correctly. When I use something with a – or numbers, I get an error. eg:
> db.getCollectionNames();
[ "1", "2", "deviceslist", "system.indexes" ]
> db.1.find()
Sun Oct 9 22:58:22 SyntaxError: missing ; before statement (shell):1
>
Is there something I am missing or does mongodb just dont accept these things??
I’ve tried combinations of
db.’1′.find()
db.”1″.find()
and none seem to work.
Help please..
You should be able to access the collection in the following way:
or
but i don’t know, if there are any negative side-effects when naming a collection like so.