2013-02-27 66 views
1

想我含有S蒙戈數據庫:如何做這種查詢的MongoDB中

[ 
    { 
     name: tom, 
     tags: ["a","b"] 
    } 
    { 
     name: lee, 
     tags: ["b","c", "d"] 
    } 
    { 
     name: jack, 
     tags: ["c","d"] 
    } 
] 

我想要找的對象,它的標籤包括b,像上面tomlee

等什麼查詢句子我可以用嗎?

回答

2
db.collection.find({ tags: "b" }) 

就這麼簡單。