对MongoDB集合名称使用点号表示法的缺点是什么? [英] What are the drawbacks of using dot notation for MongoDB collection names?

查看:83
本文介绍了对MongoDB集合名称使用点号表示法的缺点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很想使用点表示法为我的MongoDB集合名称创建名称空间.

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

例如:

users
users.admins
users.developers

这是个坏主意吗? 这样做时是否有任何潜在的问题,弊端或局限性?

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

推荐答案

这没有错.实际上,这本书建议在第8页的集合中使用点符号.这些作为subcollections;但是,该术语似乎并未得到广泛使用.

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.

重要的是要意识到,您在问题中列出的3个集合是3个不同的集合,除了它们的命名之外,彼此之间没有任何关系.点标记在MongoDB功能方面没有任何作用.

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.

这篇关于对MongoDB集合名称使用点号表示法的缺点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆