0
我想獲取具有特定信息的所有文檔。如何在服務器上搜索多個文檔
比方說,這些都是文件:
{name: "doc1", info: ["x","y","z","t"]}
{name: "doc2", info: ["x","y","a","b"]}
{name: "doc3", info: ["q","w","e","r"]}
我希望得到一個具有信息數組中"y"
的文件。 在蒙戈外殼,我可以很容易地find()
實現這一目標:
db.collection.find({info: "y"})
上面的代碼給了我兩個DOC1和DOC2:
{name: "doc1", info: ["x","y","z","t"]}
{name: "doc2", info: ["x","y","a","b"]}
然而,同樣的方法是行不通的流星那樣服務器。 是否有一個等效的代碼在服務器上執行此操作?
什麼是'fetch()'。非常感謝! – stackyname