@@ -126,7 +126,7 @@ function Model(doc, fields, skipId) {
126
126
* top level (non-sub) documents.
127
127
*/
128
128
129
- Object . setPrototypeOf ( Model . prototype , Document . prototype ) ;
129
+ Model . prototype . __proto__ = Document . prototype ;
130
130
Model . prototype . $isMongooseModelPrototype = true ;
131
131
132
132
/**
@@ -1218,7 +1218,7 @@ Model.discriminator = function(name, schema, options) {
1218
1218
model = this . db . model ( model || name , schema , this . $__collection . name ) ;
1219
1219
this . discriminators [ name ] = model ;
1220
1220
const d = this . discriminators [ name ] ;
1221
- Object . setPrototypeOf ( d . prototype , this . prototype ) ;
1221
+ d . prototype . __proto__ = this . prototype ;
1222
1222
Object . defineProperty ( d , 'baseModelName' , {
1223
1223
value : this . modelName ,
1224
1224
configurable : true ,
@@ -4944,8 +4944,8 @@ Model.compile = function compile(name, schema, collectionName, connection, base)
4944
4944
model . modelName = name ;
4945
4945
4946
4946
if ( ! ( model . prototype instanceof Model ) ) {
4947
- Object . setPrototypeOf ( model , Model ) ;
4948
- Object . setPrototypeOf ( model . prototype , Model . prototype ) ;
4947
+ model . __proto__ = Model ;
4948
+ model . prototype . __proto__ = Model . prototype ;
4949
4949
}
4950
4950
model . model = function model ( name ) {
4951
4951
return this . db . model ( name ) ;
@@ -5037,8 +5037,8 @@ Model.__subclass = function subclass(conn, schema, collection) {
5037
5037
_this . call ( this , doc , fields , skipId ) ;
5038
5038
} ;
5039
5039
5040
- Object . setPrototypeOf ( Model , _this ) ;
5041
- Object . setPrototypeOf ( Model . prototype , _this . prototype ) ;
5040
+ Model . __proto__ = _this ;
5041
+ Model . prototype . __proto__ = _this . prototype ;
5042
5042
Model . db = conn ;
5043
5043
Model . prototype . db = conn ;
5044
5044
Model . prototype [ modelDbSymbol ] = conn ;
0 commit comments