Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-77

MongoCollection.Save() Upserts a random document if it cannot match the ID.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      I have a class:

      public class Foo
      {

      public ObjectId _id

      { get; set; }

      public string Name { get; set; }

      public string Summary

      { get; set; }

      }

      And I have a function for inserting it

      public void EditFoo(Foo fooBar)

      { _db["fooBar"].Save(fooBar, SafeMode.True); }

      If fooBar._id exists in the database the save function does an update. If fooBar.Id does not exist it seems as if the driver is picking a document in the collection. and replacing it with my content.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            zippy1981 Justin Dearing
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: