How to find the subdocument via subdocument id in mongoose?
I want to find the subdocument in mongoose by subdocument id.
i am doing :
mainDoc.subDocFieldName.id(sudocId);
But it shows
'cannot find property id of undefined'
seems like mainDoc.subDocFieldName is undefined.
so how do i access the sub document.?
No comments:
Post a Comment