Добавление данных в массив внутри моего массива мангустов - PullRequest
0 голосов
/ 14 апреля 2019

Схемы Мангуста не могут сделать массив в массиве. Как я могу это сделать?

plantationLocation и productExpense поле как добавить?

    seasonIdentification: [{
                   ....
            plantation: [{
                    .....
                    plantationLocation: [{
                            ....
                    }],
                    productSheama: [{
                            .....
                            productExpense: [{
                                    ....
                            }],

                    }]
            }]

exports.plantationLocation= function (req, res) {
    agriculture_User.update({_id:req.params.id,'season._id':req.params.seasonId,'plantation._id':req.params.plantationId}, {
        '$push':{
            'seasonIdentification.$.plantation.$.plantationLocation':[{
                'lat': 1231,
                'long': 12345,
                'Accuracy': 123456,
            }]
        }
    }, function (err, product) {
        if (err) res.send(err);
        res.send('Plantation Location true.');
    });
};
...