`FindOneAndUpdate` returns `ErrNoDocuments` instead of real server error.

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Critical - P2
    • 2.8.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Go Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      The API `FindOneAndUpdate()` returns `ErrNoDocuments` (no documents in result) even when documents matching the match-filter exist on the cluster. This has been observed with mongodb versions 6, 7, 8 and 9. With mongodb version 9.0, the frequency of this behaviour has increased with server returning errors with NoWritesPerformed. This was reproduced in a load test with 9.0. Reproducing this with the previous versions has been non-trivial, however, this behaviour has been seen during production mongosync migrations.

      For error traces, please see the attached files err_FindOneAndUpdate.txt and err_from_equivalent_RunCommand.txt

      Definition of done

      The driver must expose the underlying server error to the application layer appropriately so that the application can handle any retryable errors.

      Pitfalls

      The implementer must understand the semantics of server's findAndModify operation comprehensively - including scenarios like: multiple application threads issue FindOneAndUpdate() for the same document and with the same update.

        1. err_from_equivalent_RunCommand.txt
          3 kB
          Mankawaldeep Singh
        2. event_coalescing_model_notes.txt
          3 kB
          Mankawaldeep Singh

            Assignee:
            Qingyang Hu
            Reporter:
            Mankawaldeep Singh
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: