1

s mongo データベースがあるとします。

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

上記のbように、タグに含まれるオブジェクトを見つけたいtomlee

では、どのようなクエリ文を使用できますか?

4

1 に答える 1

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

そのような単純な。

于 2013-02-27T03:38:52.637 に答える