If I have a MongoDB collection that looks like this:
_id: ObjectId(" <a objectid> ")
id: " <a userid> "
__v: 0
subscribedTo: Object
With or without Mongoose, how can I query the first child of object subscribedTo, which is called infl and it's an array?
what I'm trying is this, but it says "infl" is undefined:
const foundUser = await Sub.findOne ({ "id" : userId });
console.log("this "+JSON.stringify(foundUser.subscribedTo.infl))
Although when I console log only foundUser.subscribedTo it correctly logs:
this [{"infl":["item1","item2"],"inflId":["item1id","item2id"]}]
.subscribedTo.infl? What do you get if you only console logfoundUser?