I have a dataset like this:
{
page1: ["login", "registration"], // Here multiple pagename will store
page2: ["5c35f1045643180d9488221f"] // Here Multiple id will store
},
{
page1: ["login", "registration"],
page2: []
}
So on my data query I want to get data in which page1 === "login" and page2 === "5c35f1045643180d9488112f".
So I tried to get this through $and query but I am not getting anything.
My code is this:
db.collection.find(
{
$and: [
{page1: {$in: ["login"]}},
{page2: {$in: ["5c35f1045643180d9488221f"]}}
]
}
)
I don't know where I am doing mistake. Kindly suggest me if I am wrong or wrote the wrong statement on query. Thanks in advance.