I have a schema MySchema on which I have defined virtuals. When I query for documents based on MySchema, the documents’ properties do not include the virtual ones. How can I specify that I want my query result to include the virtual properties?
I have a schema MySchema on which I have defined virtuals. When I query
Share
The virtuals are there, they just don’t show up as properties of the Model object. I assume you’re trying something like
console.log(results),and you’re right, you won’t see the virtuals there. But if you do something like:Then you’ll see the virtuals if you’ve defined them properly.