Does Dynamoose have support for schema.virtual()
? Or is there any way to achieve this same behaviour?
I can't see it in the v2 documentation but it seems that there was some sort of support for it in the past - see this.
I know that Dynamoose is heavily inspired by Mongoose, and Mongoose has this functionality as seen here.
i know its been a long time but i found a creative solution for this issue.
in dynamoose there is an option to return a calculated value of an attribute from the DB, so the custom (virtual) attribute can be part of it!
example from my code:
in my example the script attribute is an attribute from the DB, instead of just returning its value, it return an object that contain the the script value and the reading time custom field based on the script value! hope i helped. :)