Answer the question
In order to leave comments, you need to log in
Mongoose doesn't save array changes, what should I do?
I have a database on mongoose
const user = new mongo.Schema({
profile: {
id: Number,
nick: String,
gold: Number,
health: Number,
health_max: Number,
status: {
id: Number,
name: String
}
},
documents: {
passport: {
name: String,
availability: Number
},
pass: {
quantity: Number,
_type: Number
}
},
training: Boolean,
locate: Number,
stage: Number,
food_warehouse: Array
});
food_warehouse: [{name: "яблоко", "id": 1}]
food_warehouse: [{name: "яблоко", "id": 0}]
_user.updateOne({"food_warehouse.id": _user.food_warehouse[i].id}, {
$set: {
"food_warehouse.$.id": 123
}
},
{strict: false})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question