在数组子文档中通过数组进行Mongoose搜索

时间:2017-06-01 03:32:04

标签: node.js mongodb mongoose

我在mongoose子文档中过滤数据时遇到了一些问题。我有这样的集合

[
    {
        Title : "Some Title",
        Tags : [
            "angular", "html"
        ]
    },
    {
        Title : "Another Title",
        Tags : [
            "css", "html"
        ]
    },
    {
        Title : "Another Title 2",
        Tags : [
            "css"
        ]
    }
]

我想通过查找匹配标记来获取一些数据。如果标签是" angular"和" html"然后我得到第1行(来自angular和html)和第2行(来自html)。如果标签是" css",那么我得到第2行和第3行。

如果可能那样做?我使用的是猫鼬

0 个答案:

没有答案