Shi*_*mar 4 database mongodb node.js mongoose-schema
我正在尝试将数据插入mongodb cloud的 mongodb 中。但是在运行代码时,我收到类似 TypeError: this.$__setSchema is not a function 的错误。

//Function Called
this.$__setSchema(_schema);
//Function Definition
Document.prototype.$__setSchema = function(schema) {
schema.plugin(idGetter, { deduplicate: true });
compile(schema.tree, this, undefined, schema.options);
// Apply default getters if virtual doesn't have any (gh-6262)
for (const key of Object.keys(schema.virtuals)) {
schema.virtuals[key]._applyDefaultGetters();
}
if (schema.path('schema') == null) {
this.schema = schema;
}
this.$__schema = schema;
this[documentSchemaSymbol] = schema;
};
Run Code Online (Sandbox Code Playgroud)
小智 6
猫鼬.型号 \xe2\x9c\x98
\n猫鼬.模型 \xe2\x9c\x94
\n您需要将 Model 的第一个字母更改为小写字母。如果您使用大写字母,则会收到此错误(“TypeError:this.$__setSchema 不是函数”)。
\n