mongoimport query for upsert the fields
<p>I have record like this</p>

<pre><code>{ "name" : "durga prasad", "company" : "big datamatica", "size" : 50, "role" : "CEO" }
</code></pre>

<p>I need to update like this</p>

<pre><code>{ "name" : "durga prasad", "company" : "google", "size" : 50, "role" : "CEO" }
</code></pre>

<p>when i use import</p>

<pre><code>mongoimport -d durga -c prasad --upsert --upsertFields name,company,size,role sample.json
</code></pre>

<p>I able to get </p>

<pre><code>{ "name" : "durga prasad", "company" : "big datamatica", "size" : 50, "role" : "CEO" }
{ "name" : "durga prasad", "company" : "google", "size" : 50, "role" : "CEO" }
</code></pre>

<p>I am getting both the records I need updated record only
If the field not exists it should add to the existing record</p>