“MongoError:无法使用该部件遍历元素”

时间:2017-04-25 07:06:08

标签: node.js mongoose

我在我的节点应用程序中使用mongoose,我有一个集合如下,

enter image description here

当我更新座位状态时,它会返回错误说明,

{ MongoError: cannot use the part (seating of ticket.seating.attachment.0.enabled) to traverse the element ({seating: [ { ticketUrl:

我的代码

 return dbService.findOneAndUpdate(Model, {
       'listingId': attachmentObj.listingId,
        'ticket.seating.attachment.attachmentUrl': attachmentObj.attachmentUrl
           }, {
        $set: {
       'ticket.seating.attachment.$.enabled': true
      }
 })

0 个答案:

没有答案