Skip to content

Invalid atomic update value for $set. Expected an object, received object #4775

@tosbaha

Description

@tosbaha

If I try to update my document via

Parcel.findOneAndUpdate({_id:parcel.trackingID},{$set:parcel},{new: true},function(err,result) {
    //
})

I get Invalid atomic update value for $set. Expected an object, received object error. However if I do,

Parcel.findOneAndUpdate({_id:parcel.trackingID},parcel,{new: true},function(err,result) {
  //
})

It is working without any error. parcel is an object which has the same properties with a schema plus some extra properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions