Rethinkdb update nested object
<p>I have a document like below-</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>{  
 "badgeCount": {  
  "0e2f8e0c-2a18-499d-8e64-75b5d284e31a": 0 , 
  "c0d07f5c-25ff-4829-8145-c33c0871f889": 0 
 } , 
 "createdDate": Mon Oct 10 2016 19:25:10 GMT+00:00 , 
 "deleted": false , 
 "id": "1330c8b8-38a2-46e4-b93d-f7ff84a423ed",
 "joinedUserIds": 
 [  
  "0e2f8e0c-2a18-499d-8e64-75b5d284e31a" 
 ]   
}</code></pre>
</div>
</div>
</p>

<p>What I want to do is remove joinedUserId "0e2f8e0c-2a18-499d-8e64-75b5d284e31a" and update badgeCount by removing first property "0e2f8e0c-2a18-499d-8e64-75b5d284e31a": 0 in the same query.</p>

<p>I tried updating badgeCount like below-</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>  r.db('mydb').table('discussion').filter({"id": "1330c8b8-38a2-46e4-b93d-f7ff84a423ed"})
    .update(function(s){
      return {
        badgeCount: s('badgeCount').without("0e2f8e0c-2a18-499d-8e64-75b5d284e31a")
      }
    })</code></pre>
</div>
</div>
</p>

<p>But it does not working. Not sure what I am missing. </p>

<p>Thanks
Anup</p>