Adding JSON to an array in mongo database
<p>I'm trying to add a json map to an array in my database using <code>monger</code> but there is something wrong. I've found how to do it in monger documentation, but <code>$push</code> and <code>$addToSet</code> aren't working:</p>

<p>Here is my function:</p>

<pre><code>(defn add-vehicle [vehicle]
    (let [connect-string (System/getenv "MONGO_CONNECTION")
          {:keys [conn db]} (mg/connect-via-uri connect-string)]
        (mc/update db "drivers-collection" 
                   {:email (:email vehicle)} 
                   {$addToSet {:cars (:vehicle vehicle)}})))
</code></pre>

<p>And this is how I'm calling this function in <code>nREPL</code>:</p>

<pre><code>(add-vehicle {:email "teste111@hotmail.com" 
              :vehicle {:model "fusca" 
                        :color "rosa" 
                        :plate "AIO-9807"}})
</code></pre>

<p>Any ideas?</p>

<h2>EDIT</h2>

<p>This is my document in <code>drivers-collection</code>:</p>

<pre><code>{
    "_id": {
        "$oid": "57bee61edcba0f2f7559eb56"
    },
    "email": "teste111@hotmail.com",
    "name": "Guilherme Job",
    "cars": [],
    "customerId": "cus_9O4dhvtuF2926m"
}
</code></pre>

<p>My car's array are empty and I'm trying to add a vehicle into it.</p>