Mongoose has a feature to check if a field is populated. But this only works as long as the response object is a mongoose object. Once I use lean() on my query, I'm not able to check if the field is populated.
Question:
- I have a field, that has to be checked if it's populated. I'm running a lean() query and now I'm unable to figure out if the field is populated.
- When I check the typeof for the field, it shows it's an object.
- Is there any way to check if a field is populated if it is a lean() query?