向MongoDB Cloud插入数据时触发TypeError: this.$__setSchema非函数
报错场景
- 操作场景:向MongoDB云服务平台写入数据
- 触发报错:执行代码时抛出
TypeError: this.$__setSchema is not a function - 配套材料:已附对应运行报错截图
涉及的代码片段
触发报错的调用代码
// 被调用的代码 this.$__setSchema(_schema);
对应方法的定义代码
// 对应函数定义 Document.prototype.$__setSchema = function(schema) { schema.plugin(idGetter, { deduplicate: true }); compile(schema.tree, this, undefined, schema.options); // 若虚拟属性未配置默认getter则补充应用(对应issue 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; };
内容的提问来源于stack exchange,提问作者Shivam Kumar
相关产品推荐
相关产品推荐

