Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4999

Write Concern 0 Must Not Affect Read Operations

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.14.0
    • Affects Version/s: 4.13.0
    • Component/s: None
    • Labels:
    • 3
    • 3
    • Not Needed
    • Not Needed

      When the driver has a write concern of 0 it does not apply the lsid to any initial command, including reads. This causes issues with cursors as the initial find command does not have an lsid attached but the subsequent getMore commands do. This causes an error on the server: "Cannot run getMore on cursor x, which was not created in a session...".

      Steps to reproduce:

      • Create a client with writeConcern 0.
      • Insert documents into a collection more than the default batch size
      • Execute collection.find({}).toArray() to run the find and at least one getMore

      The sessions spec states the lsid MUST be sent on all commands with 1 exception being unacknowledged writes - the driver is improperly treating reads the same here: https://github.com/mongodb/node-mongodb-native/blob/main/src/sessions.ts#L960

      Open question: What should be the behaviour for the generic run command?

            Assignee:
            warren.james@mongodb.com Warren James
            Reporter:
            durran.jordan@mongodb.com Durran Jordan
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: