MongoDB Nested Documents Update with python
<p>I am trying to aggregate some mongoDB records and have this returned value from an aggregation query with 1500 records:</p>

<pre><code>{
    "_id": {
        "Year": 2016,
        "locationID": " WL 001",
        "Day": 25,
        "Hour": 12,
        "Month": 1
    },
    "temperature": 10.858749999999999,
    "pH": 0,
    "Conductivity": 2032.375
}
</code></pre>

<p>How do I insert the resulting values for <code>temperature</code>, <code>pH</code> and <code>Conductivity</code> such that the data to be inserted into the database have the following format?</p>

<pre><code>{  
    "_id": {
        "Year": 2016,
        "locationID": " WL 001",
        "Day": 25,
        "Hour": 12,
        "Month": 1
    }, 
    "Readings": {
        "pH": { "value": 8.879 },
        "temperature": { "value": 16.81 },
        "Conductivity": { "value": 1084 }
    }
}
</code></pre>

<p>I have tried several approach but I can't seem to get the result.</p>