Unable to $push and $set the data at a time in mongodb using express js
<p>I have a scenario where I need to replace the data in one array and also push the data in another array in one query itself.
Here I'm using express js framework and mongoose for queries.</p>

<p>Here is the query which I wrote:</p>

<pre><code>exports.candidateRating = function(req, res) {
console.log(req.query);
Profiles.update({
    "name": req.query.name
}, {
    $set: {
        "ratings": req.body.ratings,

    }
}, {
    $push: {
        "RoundWiseRatings": req.body.RoundWiseRatings
    }
}, function(error, profiles) {

    if (error) {

    }
    return res.status(200).json(fnStruncturedData(profiless));

});};
</code></pre>

<p>Here I'm able to set the data but unable to push data.</p>

<p>I don't understand where I'm wrong.</p>

<p>Any help would be highly appreciated.</p>