MongoDB Shell-带名称句点的访问集合? [英] MongoDB Shell - access collection with period in name?
本文介绍了MongoDB Shell-带名称句点的访问集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我们的一个MongoDB数据库中找到了一个名为my.collection
的集合.
I have found a collection in one of our MongoDB databases with the name my.collection
.
尽管名称中有一个点,是否有一种方法可以从MongoDB Shell中访问此集合?
Is there a way to access this collection from the MongoDB shell, despite it having a point in the name?
> db.my.collection.findOne();
null
我很确定那是不正确的.
I'm pretty sure that that is not correct.
推荐答案
您的代码正确.如果返回null,则表示该集合为空.
Your code is correct. If it returns null it means that the collection is empty.
这篇关于MongoDB Shell-带名称句点的访问集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文