On this page本页内容
New in version 4.4.版本4.4中的新功能。
getDefaultRWConcern¶The getDefaultRWConcern administrative command retrieves the global default read or write concern settings.
getDefaultRWConcern on a mongos.getDefaultRWConcern must be run against the admin database. getDefaultRWConcern has the following form:
getDefaultRWConcern has the following fields:
| getDefaultRWConcern | int | Set to |
| inMemory | boolean | Optional. Set to Set to |
comment |
any |
A comment can be any valid BSON type (string, integer, object, array, etc).
|
getDefaultRWConcern output includes the following fields.
| defaultReadConcern | object |
The global default read concern configuration. If this field is absent, the deployment has no global default read concern settings. |
| defaultWriteConcern | object |
The global default write concern configuration. If this field is absent, the deployment has no global default write concern settings. |
| updateOpTime | Timestamp | The operation timestamp of when any global default read or write concern setting was last modified. Present if a default has ever been set for the cluster. |
| updateWallClockTime | Date | The wall clock date when an administrator last set the global default read or write concern. This value is informational and should not be used for any recency comparisons. |
| localUpdateWallClockTime | Date | The wall clock date when the |
See also参阅
Requires featureCompatibilityVersion 4.4+
Each mongod in the replica set or sharded cluster must have featureCompatibilityVersion set to at least 4.4 to use getDefaultRWConcern. If you downgrade your deployment’s featureCompatibilityVersion from 4.4 to 4.2, all cluster-wide read and write concern defaults are lost, but mongos instances may continue applying the defaults for up to 30 seconds.
You can issue getDefaultRWConcern against any data-bearing member of the replica set (i.e. not against an arbiter).
A secondary can return a ‘stale’ version of the global default settings if it has not yet replicated the latest changes from the primary.
Issue the setDefaultRWConcern against a mongos in the cluster.
Each mongos periodically refreshes its local copy of the global default settings. A mongos can return a ‘stale’
version of the global default settings if it has not yet refreshed its local copy after a recent update to the global default settings or if it fetched its settings from a lagged config server secondary.
The global default settings do not propagate to the individual shards. You cannot run getDefaultRWConcern against a shard.
For replica sets or sharded clusters enforcing Authentication, getDefaultRWConcern requires that the authenticated user have the getDefaultRWConcern privilege action.
The clusterManager or clusterMonitor built-in roles provides the required privileges to run getDefaultRWConcern.