在 mongodb atlas 中查询以验证集合中是否存在多个特定文档

query in mongodb atlas to verify the existence of multiple specific documents in a collection

我有一个名为 employeeInformation 的 mongodb 集合,其中有两个文档:

{"name1":"tutorial1"}, {"name2":"tutorial2"}

当我执行 db.employeeInformation.find() 时,我会显示这两个文档。我的问题是 - 是否有一个查询可以让我 运行 确认该集合仅包含这两个指定的文档?我尝试了 db.employeeInformation.find({"name1":"tutorial1"}, {"name2":"tutorial2"}) 但我只得到了与键为“name1”的第一个对象对应的 ID。我知道只需查看 .find() 的结果就可以轻松处理 2 个文档,但我想确保在将多个(100 个)文档插入集合的情况下,我有一种方法可以验证该集合包含所有且仅包含这 100 个文档(请注意,我将始终将对象本身作为文本)。理想情况下,此查询也应该在 mongoatlas console/interface 中工作。

db.collection.count()

插入文档后会给出插入次数。

谢谢, 尼哈