I'm using the migrate-mongo library and have this simple migration to create a view. 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
However they're using mongoose where this isn't (shouldn't be)
I mixed up the mongodb terminal commands with node.js syntax. The drop line should be db.collection('content').drop()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.