Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-10803

Highlight renameCollection caveats

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      The renameCollection command says it is "suitable for production environments:
      https://docs.mongodb.com/manual/reference/command/renameCollection/#behavior

      .. and then highlights two caveats that contradict this:

      • renameCollection blocks all database activity for the duration of the operation.
      • renameCollection is not compatible with sharded collections.

      The most important warning is lurking below the example:

      This command obtains a global write lock and will block other operations until it has completed.

      I think this should not be recommended for production environments and the warning on global lock should be prominently featured. An initial skim of the "blocks all database activity" point might suggest that this only blocks activity for the current database rather than globally.

      Note: SERVER-15723 will improve the lock granularity for renames within the same database, but renaming a collection between databases will still involve a global write lock while the data is copied to the target database.

            Assignee:
            stephen.steneker@mongodb.com Stennie Steneker (Inactive)
            Reporter:
            stephen.steneker@mongodb.com Stennie Steneker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              6 years, 33 weeks, 2 days ago