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})