Thanks for starting this post. I am using Mongoose 5.3 and I'm having issues with making changes to my existing schema.
I don't have each model in different files, they are all in the same file and then get exported as part of a single app schema, so how would I access Base within the same file. I tried something like this:
However, when I try to load my app, it complains with error:
Base.discriminator is not a function
I tried upgrading mongoose to version 5.4.2 and I am still getting this error.
UPDATE: My issue seems related to the fact that I need to work on a deeply embedded doc and this array of objects is what needs to be able to inherit from the base class. Example, person object with embedded belongings array, which contains a media array, where the movies, books, etc. are store and these media items need to share a schema
Update below:
Thanks for starting this post. I am using Mongoose 5.3 and I'm having issues with making changes to my existing schema.
I don't have each model in different files, they are all in the same file and then get exported as part of a single app schema, so how would I access Base within the same file. I tried something like this:
However, when I try to load my app, it complains with error:
Base.discriminator is not a function
I tried upgrading mongoose to version
5.4.2
and I am still getting this error.UPDATE: My issue seems related to the fact that I need to work on a deeply embedded doc and this array of objects is what needs to be able to inherit from the base class. Example,
person
object with embeddedbelongings
array, which contains amedia
array, where the movies, books, etc. are store and these media items need to share a schemaSame with me, did u solve it?