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

GridStore fails to store a file if retryWrites=True and the collection doesn't exist

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Native
    • Labels:
      None

      GridStore fails to store a file depending on the combination of "retryWrites" configuration and the existence of the collection.

      const gs = new GridStore(_self.myDB, fileId, filepath, "w", {root: "defaultimages", metadata: {_CompanyID: _CompanyID}});

      In that line we are defining defaultimages as the collection to store the data, so the chunks will be in defaultimages.chunks. If the collection doesn't exist, the driver should create it automatically.

      I have found that it will work or fail depending on the combination of retryWrites configuration and the existence of defaultimages collection:

      • If you are using retryWrites=true and the collection doesn't exist, the driver won't create it and the NodeJS app will fail.
      • If you are not using retryWrites=true and the collection doesn't exist, the driver will be able to create the collection and it will work as expected.
      • If the collection already exists, doesn't matter what value you have in retryWrites, it will always work.

            Assignee:
            Unassigned Unassigned
            Reporter:
            miguel.nieto@mongodb.com Miguel Angel Nieto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: