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

When calling Save with a custom ID generator in place, the default is Insert instead of Upsert

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 1.8.1
    • None
    • None
    • Windows 7, Visual Studio 2012

    Description

      I have implemented a custom ID generator that is a hash of a couple of other fields in our document to create a single key out of a combination key. When Iregister this generator and call Save, passing in an object of our document type, if the IsEmpty method of our IIDGenerator implementation returns true, the GenerateId method is called, and then Insert is called. Since the Save method is supposed to be an more of an upsert, it feels more natural that this would call Update with the Upsert flag set as is done a few lines later in the code if the IsEmpty method returns false (however in this case, the custom generator is not called).

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            wkaple Wade Kaple
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: