I have this code.
Instead of hardcoding the value done in red, i need it to match with the cityId and get the respective element.
If I hardcode the cityId, it returns me the array element but if I pass cityId
, it return null. What is the fix?
@duard_N_A you solved a similar problem here. MongoDB: Filter an array by _id using aggregate - #5 by duard_N_A. Can you help?