title: add documents to collection pymongo
body: <p>I have a collection of documents like this:</p>
  
  <pre><code>{'_id': ObjectId('5a66f98facb83b71b36aa44a'), 'UID': '', 'profile': {'firstName': '', 'lastName': '', 'email': ''},  'status': 'ACT'}
  </code></pre>
  
  <p>but now I want to add to this collection a list of other documents (in python I have a list of dicts -> <em>datilist</em>) in order to:</p>
  
  <ul>
  <li>update existing fields values if the index field matches with the one already present and eventually add new missing keys/value pairs</li>
  <li>add to the collection if there is no match against index field value </li>
  </ul>
  
  <p>I have created an index with this statement</p>
  
  <pre><code>db.utenti.createIndex( { "profile.email": 1 }, { unique: true } )
  </code></pre>
  
  <p>In order to avoid duplicates.</p>
  
  <p>I've tried to perform something like this:</p>
  
  <pre><code>utenti.update_many({},datilist.$[],upsert=True)
  </code></pre>
  
  <p>But obviously there is something that I am missing.. I think that this should be a one liner for Mongodb, I'm a newbie.</p>