dimanche 20 février 2022

Class method returning Sub-Class in JavaScript

In Mongoose documentation we find:

In Mongoose, the term "Model" refers to subclasses of the mongoose.Model class.
You should not use the mongoose.Model class directly.
The mongoose.model() function creates subclasses of mongoose.Model...

I have never seen this kind of design pattern where a class method creates subclasses (not instances) of itself. Does this design pattern have a name?

Offical doc can be found here: https://mongoosejs.com/docs/api/model.html

Aucun commentaire:

Enregistrer un commentaire