Empty _id using ReplaceOneAsync

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi,
      running that code :

      await this.Collection.ReplaceOneAsync(x => x.Name == city.Name x.CountryCode == city.CountryCode, newObject, new UpdateOptions()

      { IsUpsert = true }

      );

      if the object doesn't exist it create the new one but with an empty id.
      Here what is stored

      /* 1 */

      { "_id" : ObjectId("000000000000000000000000"), "CreateAt" : [ NumberLong(635700317931446025), 0 ], "UpdateAt" : [ NumberLong(635700317931446025), 0 ], "Name" : "My value", "CountryCode" : "it", "Culture" : "en-US" }

            Assignee:
            Unassigned
            Reporter:
            Ugo Lattanzi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: