I have a mongo document with some default behavior
var thingSchema = new mongoose.Schema(
things:
first: {
type: Boolean,
default: false
},
second: {
type: Boolean,
default: false
}
);
var myThings = mongoose.model('Things', thingsSchema);
If I then update first
myThings.update({things: {first: true}});
and output Things
Things.find(function(err, things){
console.log(things) // {things: {first: true}, {second: false}}
});
and I then update the second value
myThings.update({things: {second: true}});
I get {things: {first: false}, {second: true}} when I output again, instead of the desired {things: {first: true}, {second: true}}.
Without having to pass both first and second values to update each time, how can I keep my model from reverting back to its default behavior?