Thanks for the plugin. I just noticed that virtuals in discriminators don't work if the result of a query is an array.
The problem is how you check which discriminator schema to apply on line 43 - 51. In attachVirtuals, res can be an array, and each of the documents can have a different schema. This method, however, only works for single documents.
I will submit a PR for this, including unit tests.
Hi there,
Thanks for the plugin. I just noticed that virtuals in discriminators don't work if the result of a query is an array.
The problem is how you check which discriminator schema to apply on line 43 - 51. In
attachVirtuals
,res
can be an array, and each of the documents can have a different schema. This method, however, only works for single documents.I will submit a PR for this, including unit tests.