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

Document limited circumstances for writing to the configdb

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual
    • None

    Description

      The docs at https://docs.mongodb.org/manual/reference/config-database/ state:

      IMPORTANT
      Consider the schema of the config database internal and may change between releases of MongoDB. The config database is not a dependable API, and users should not write data to the config database in the course of normal operation or maintenance.

      WARNING
      Modification of the config database on a functioning system may lead to instability or inconsistent data sets. If you must modify the config database, use mongodump to create a full backup of the config database.

      While all of this is true, there is one situation where it is acceptable to write to the config db. This is the case of doing a test write to unused collection in order to verify the write availability of the config servers. For example, running the following on a mongos:

      db.getSiblingDB("config").testConfigServerWriteAvail.update( { _id: 1 }, { $inc: { a: 1 } }, { upsert: true } )
      

      If this succeeds, the the config servers are up and able to successfully process writes. If this fails, then they are not.

      Since the collections in the config db may change over time (ie. future releases of the server may use collections that older versions do not), users wishing to do this must choose the name of test-write collection very carefully to avoid any potential collisions in the future (hence "testConfigServerWriteAvail" in the example above).

      It is still never acceptable under any circumstances to store any general-purpose user data in the config db, since that's not its intended purpose and it hasn't been designed for such a use case.

      Attachments

        Activity

          People

            steve.renaker@mongodb.com Steve Renaker (Inactive)
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 46 weeks ago