【发布时间】:2013-08-12 19:16:03
【问题描述】:
我正在尝试使用 mocha 测试我的 API,但每次我在使用 populate(field) 的模型上调用方法时,它都会失败并显示 Uncaught MissingSchemaError: Schema hasn't been registered for model "Kitchen".
Use mongoose.model(name, schema)。
最小示例:https://gist.github.com/connors511/6204164(transaction.js 是违规者)
我也尝试过将该方法用作 schema.statics,但它返回的结果与示例相同。
如果我从 _listForUserClub 方法中删除 populate('where.kitchen'),则 MissingSchema Club 会失败。
知道是什么原因造成的,或者如何解决?
【问题讨论】:
标签: node.js unit-testing mongoose mocha.js