When I query monodb shell, I AM able to update the document. This is the mongodb command I use: db.users.update({name:"bob"}, {$set: {email:"[email protected]} })
But when I try to update it with mongoose, it doesn't work. What am I missing??
This is the code in mongoose:
// Create the users schema
var userSchema = mongoose.Schema({ name: String, email: String }, {collection: "users"}); // Create a model
var userModel = mongoose.model("userModel", userSchema); // Update a document
userModel.update({name:"bob"}, {$set: {email:"[email protected]"}} );