update item of array of array in mongodb
<p>I want to push an item to the array of items (root document > categories > subcategories > items)</p>

<p>I am using NodeJS with MongoDB npm package</p>

<p>My document structure should be like the following</p>

<pre><code>{
    "_id": "572a77641b24ed3404f43690"
    "categories": [
        {
            "id": "572bbac072d7ee3026a69467"
            "Name": "Foods",
            "subcategories": [
                {
                    "id": "572a777c1b24ed3404f43691",
                    "Name": "Pizza"
                    "items": [
                        {
                            "id": "572ba1666ca263303121acd4"
                            "Name": "4 Seasons",
                            "Price": "6.0"
                        }
                    ]
                }
            ]
        }
    ]
}
</code></pre>

<p>My current code is</p>

<pre><code>app.post("/item/:subcatid", function(req, res) {
    var subId = req.params.subcatid;
    var item = req.body;

    item.id = new ObjectId();

    items.update({ "categories.subcategories.id": ObjectId(subId) }, { $push: { "categories.0.subcategories.$.items": item } }, function(err, result) {
        res.send(result);
    });
});
</code></pre>

<p>What can I do ?</p>