[英]Cannot read property 'drop' of undefined in simple migration
I'm using the migrate-mongo library and have this simple migration to create a view.我正在使用migrate-mongo 库并通过这个简单的迁移来创建视图。 However I'm getting an error on migrate down.
但是,我在向下迁移时遇到错误。
ERROR: Could not migrate down 20220620114132-CreateContentView.js: Cannot read property 'drop' of undefined
module.exports = {
async up(db, client) {
db.createCollection('content', {
viewOn: 'assets',
pipeline: [...stuff]
})
},
async down(db, client) {
db.content.drop()
}
}
I notice that this question has the same error: TypeError: Cannot read property 'drop' of undefined我注意到这个问题有同样的错误: TypeError: Cannot read property 'drop' of undefined
However they're using mongoose where this isn't (shouldn't be)然而,他们在不是(不应该)的地方使用猫鼬
I mixed up the mongodb terminal commands with node.js syntax.我将 mongodb 终端命令与 node.js 语法混合在一起。 The drop line should be
db.collection('content').drop()
下降线应该是
db.collection('content').drop()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.