简体   繁体   English

无法在简单迁移中读取未定义的属性“删除”

[英]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.

相关问题 无法读取简单表的未定义属性'mData' - Cannot read property 'mData' of undefined for a simple table Sequelize 迁移错误:无法读取未定义的属性“长度” - Sequelize migration error: Cannot read property 'length' of undefined 无法读取未定义的属性“ handle”。 Parse.com迁移 - Cannot read property 'handle' of undefined. Parse.com migration Sequelize 运行迁移结果无法读取未定义的属性“键” - Sequelize running migration results Cannot read property 'key' of undefined jade 到 pug 迁移 => 无法读取函数调用中未定义的属性“每个” - jade to pug migration => Cannot read property 'every' of undefined on function call 角度拖动n拖放中的“无法读取未定义的属性'then'” - “ Cannot read property 'then' of undefined” in angular drag n drop 创建拖放卡时无法读取未定义的属性“地图” - Cannot read property 'map' of undefined when creating drag and drop cards 简单请求:未捕获的TypeError:无法读取未定义的属性“长度” - Simple Request: Uncaught TypeError: Cannot read property 'length' of undefined TypeError:无法读取未定义的属性'isCompleted'-React Simple Todo应用 - TypeError: Cannot read property 'isCompleted' of undefined - React simple todo app 简单的表单验证帮助“无法读取未定义的属性'元素'” - Simple form validation help “Cannot read property 'elements' of undefined”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM