Tuesday, 14 March 2017

Not able to update data with schema set as empty object in mongoose

Defined a schema with empty object.

var Sample = mongoose.Schema({ any: Mongoose.Schema.Types.Mixed });

Update query

var P = db.model('Sample', Sample);
P.update({}, {$set:{"abc":"new value"}}, options, callback)

I have set debug mode of mongoose to true. Whenever I hit the find query mongoose debug mode logs the query and gives appropriate results But when i hit the update query , it neither logs the query nor update the document.

Any alternative way to execute update query without defining the schema?



via swapnilp

No comments:

Post a Comment