db.getCollection('comments').findByIdAndUpdate({"taskId": mongoose.Types.ObjectId(5b7fb3fe79c0831ec027a5bd)},{ '$push': { "commentDetail": { comment: 'sfsf fsdf' } }})
这是我的查询。获得了意外的令牌ILLEGAL。我刚刚开始学习Mongo和Node。
使用findOneAndUpdate。喜欢
db.getCollection('comments').findOneAndUpdate({"taskId": mongoose.Types.ObjectId(5b7fb3fe79c0831ec027a5bd)},{ '$push': { "commentDetail": { comment: 'sfsf fsdf' } }})