Update document with error: Cast to string failed for value undefined

前端 未结 2 1159
半阙折子戏
半阙折子戏 2021-01-13 22:03

I have a simple document with name (require), description (optional). In my model, I update a document with a valid id and I pass description with value undefined because I

2条回答
  •  天命终不由人
    2021-01-13 22:33

    Try dropping down to the native driver like so:

    var update = function (model, callback) {
       RoleSchema.update({_id: model.id}, {$unset: {description: 1 }}, callback);
       });
    };
    

提交回复
热议问题