title: Update Document on MongoDb
body: <p>I'm trying to update document on mongodb. Document like this:</p>
  
  <pre><code>{
    "_id" : ObjectId("5ea10bb2b930115d186bf38c"),
    "restaurant" : "5e9ca5611abce13b6014b8ed",
    "Url" : {
      "idImage" : null,
      "Url" : null
     }
  }
  </code></pre>
  
  <p>I want to update Url object, but i'm getting "Command update failed: Updating the path 'Url.$.idImage' would create a conflict..".</p>
  
  <p>This is my current code:</p>
  
  <pre><code>        var user = await _context.Menu
                      .Find(filter)
                      .FirstOrDefaultAsync();
  
          var changesDocument = BsonDocument.Parse(input.ToJson());
          var firsElement = changesDocument.FirstOrDefault(x =&gt; x.Value != BsonNull.Value);
  
          UpdateResult result = null;
          if (user != null &amp;&amp; firsElement.Value != null)
          {
              var update = Builders&lt;MenuDto&gt;.Update.Set(firsElement.Name, firsElement.Value);
  
              foreach (var item in changesDocument)
              {
                  if (!item.Value.IsBsonNull &amp;&amp; item.Name != "_id")
                  {
                      if(item.Name != "restaurant")
                      {
                          var changesDocumentUrl = BsonDocument.Parse(item.Value.ToJson());
                          foreach (var value in changesDocumentUrl)
                          {
                              update = update.Set($"{item.Name}.$.{value.Name}", value.Value);
                              result = await _context.Menu.UpdateOneAsync(filter, update);
                          }
                      } else
                      {
                          update = update.Set(item.Name, item.Value);
                          result = await _context.Menu.UpdateOneAsync(filter, update);
                      }
                  }
              }
  
  
              return result.IsAcknowledged;
          }
  </code></pre>
  
  <p>How can i solve this?</p>