Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-6526

Investigate changes in SERVER-60064: Create on an existing collection on mongod should have the same behavior as mongos

    • Type: Icon: Investigation Investigation
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed

      Original Downstream Change Summary

      The create command will now report success on mongod if a collection/view with an identical namespace and options already exists. Note that this was already the behavior on mongos as of MongoDB 4.0.

      Description of Linked Ticket

      Related to SERVER-33276 and PYTHON-1936. Starting in MongoDB 4.0, the create command does not return an error when the collection already exists on sharded clusters:

      >>> client.server_info()['version']
      '4.2.3'
      >>> client.is_mongos
      True
      >>> client.test.command('create', 'test', check=False)
      {'ok': 1.0}
      >>> client.test.command('create', 'test', check=False)
      {'ok': 1.0}
      

      On replica sets and standalones the second create fails with error code 48:

      >>> client.server_info()['version']
      '4.2.3'
      >>> client.is_mongos
      False
      >>> client.test.command('create', 'test', check=False)
      {'ok': 1.0}
      >>> client.test.command('create', 'test', check=False)
      {'ok': 0.0, 'errmsg': "a collection 'test.test' already exists", 'code': 48, 'codeName': 'NamespaceExists'}
      

      We should make mongod have the same behavior as mongos for consistency across deployments.

      Another benefit of this change is that it would allow drivers to retry the create command like mongos does.

            Assignee:
            Unassigned Unassigned
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: