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)