Skip to content Skip to sidebar Skip to footer

TypeError: Cannot Use 'in' Operator To Search For '_id' In [{}]

I have a model created as follows var AddressSchema = new Schema({ category: {type: String, default: 'home'}, lines: {type: String }, city: {type: String} }); /** * Emp

Solution 1:

it is because your req.body contains address: '{}' which is string not array and not object if you write

 var body={ name: 'santhu', address: []}; //and not { name: 'santhu', address: '{}'}
 var employee = new Employee(body);

it will work fine


Post a Comment for "TypeError: Cannot Use 'in' Operator To Search For '_id' In [{}]"