Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
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.