getDefaultRWConcern
定義
getDefaultRWConcern
The
getDefaultRWConcern
administrative command retrieves the global default read or write concern settings.For sharded clusters, issue the
getDefaultRWConcern
on amongos
.
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです
注意
このコマンドは、すべての MongoDB Atlas クラスターでサポートされています。すべてのコマンドに対する Atlas のサポートについては、「サポートされていないコマンド」を参照してください。
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
コマンドの形式は次のとおりです。
db.adminCommand( { getDefaultRWConcern: 1 , inMemory: <boolean>, comment: <any> } )
コマンドフィールド
コマンドには次のフィールドがあります:
フィールド | タイプ | 説明 |
---|---|---|
整数 |
| |
ブール値 | 任意。 Set to Set to | |
| any | 任意。このコマンドに添付するユーザー指定のコメント。設定すると、このコメントは以下の場所にこのコマンドの記録と合わせて表示されます。
コメントには、有効な BSON 型(string, integer, object, array など)を使用できます。 |
出力
The output may include the following fields:
フィールド | タイプ | 説明 |
---|---|---|
| The global default 書込み保証 (write concern) configuration. If the deployment has no global default write concern settings,
this field is absent from | |
| The global default 読み取り保証 (read concern) configuration. If the deployment has no global default read concern settings,
this field is absent from | |
文字列 | デフォルトの書込み保証 (write concern) のソース。デフォルトでは、値は | |
文字列 | デフォルトの読み取り保証 (read concern) のソース。デフォルトでは、値は | |
タイムスタンプ | 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. | |
日付 | 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. | |
日付 |
以下も参照してください。
動作
注意
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 アービタ).
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 ではない propagate to the individual shards.
You cannot run getDefaultRWConcern
against a shard.
アクセス制御
For replica sets or sharded clusters enforcing
自己管理型配置での認証, 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
.
例
The following operation retrieves the currently configured
global default read and write concern for the mongod
.
db.adminCommand({ "getDefaultRWConcern": 1 })
The operation returns output similar to the following:
{ "defaultWriteConcern" : { "w" : "majority" }, "defaultReadConcern" : { "level" : "majority" }, "defaultWriteConcernSource" : "global", "defaultReadConcernSource" : "global", "updateOpTime" : Timestamp(1586290895, 1), "updateWallClockTime" : ISODate("2020-04-07T20:21:41.849Z"), "localUpdateWallClockTime" : ISODate("2020-04-07T20:21:41.862Z"), "ok" : 1, "$clusterTime" : { ... } "operationTime" : Timestamp(1586290925, 1) }