I am new to the Mongoose and NodeJS world.
I have product document where I am storing category ids as shown below.
"reviewscount" : "2",
"overallrating" : "4.5",
"urlkey" : "strive-shoulder-pack",
"productid" : "2",
"categoryid" : "3,7,4",
Now wanted to fetch all the products belongs to one category based on category Id.
I tried below code, but getting empty result
Product.find({ "categoryid" : { "$in" : [ categoryId ] } }, function (err, products) {
console.log(products);
}
Am I doing it wrong way?