Wednesday, 31 May 2017

Mongoose Search By Array in Array Sub Document

I got some problem in filtering data in mongoose subdocument. I Have collection like this

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

I want to get some data by finding match tag. If the tag is "angular" and "html" then I get row 1. And If the tags is "css", then I get row 2 and 3.

If that possible doing that? I'm using mongoose



via Adi Sparta

No comments:

Post a Comment