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

retryWrites=true, remove, and limit=0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 3.0.10
    • Fix Version/s: 3.2.0
    • Component/s: native
    • Labels:
      None

      Description

      when I run the following node script:

      #!/usr/bin/env node
      'use strict';
       
      const env = require('/Users/lineus/.env');
      const { MongoClient } = require('mongodb');
       
      const sharable = env.ATLASSRV
        .replace(/\/[^:]+:[^@]+@/, '//**:**@')
        .replace(/cl[^:]+mon/, 'cluster.mon');
       
      const pkg = require.resolve('mongodb').replace(/\/[^/]*$/, '/package.json');
      const ver = require(pkg).version;
       
      async function run() {
        console.log(`version: ${ver}`);
        console.log(`conn string: ${sharable}`);
        const client = await MongoClient.connect(env.ATLASSRV);
        const db = client.db('gh-6610');
        await db.dropDatabase();
        await db.collection('tests').insert({ name: 'Billy' });
        let found = await db.collection('tests').findOne({});
        console.log(found);
        await db.collection('tests').remove({ _id: found._id })
          .catch((e) => {
            console.error(e.message);
            return client.close();
          });
      }
       
      run();
      
      

      I get the following output:

      issues: ./6610_native.js
      version: 3.0.10
      conn string: mongodb+srv://**:**@cluster.mongodb.net/test?retryWrites=true
      { _id: 5b3247c7bcf86f208bdc5990, name: 'Billy' }
      Cannot use (or request) retryable writes with limit=0
      issues:
      

       

      I noticed NODE-1513 says that there changes coming to retryWrites in the next driver version but I wasn't sure if those changes apply to this code. It looks like the spec doesn't mention `remove` as being supported by retryWrites. Going forward will there be any effort to make remove compatible with retryWrites?

       

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: