Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the drawbacks of using dot notation for MongoDB collection names?

Tags:

mongodb

I would really like to use the dot notation to create namespaces for my MongoDB collections' names.

For example:

users
users.admins
users.developers

Is this a bad idea ? Are there any potential problems, drawbacks or limitations when doing this ?

like image 330
standac Avatar asked Feb 27 '13 17:02

standac


Video Answer


1 Answers

There is nothing wrong with this. In fact, this book recommends the use of dot notation in collections on page 8. It refers to these as subcollections; however, that term doesn't seem to be in broad use.

It's important to realize that the 3 collections you've listed in your question are 3 distinct collections with no relationship to each other except for their naming. The dot notation does not do anything in terms of MongoDB functionality.

It is useful for organization though, and the collections list nicely when sorted alphabetically. So in summary there are no any drawbacks or potential problems and you gain an advantage as your collection names are better organized.

like image 88
Zaid Masud Avatar answered Oct 10 '22 18:10

Zaid Masud