Docs Menu

db.collection.configureQueryAnalyzer()

db.collection.configureQueryAnalyzer(options)

レプリカセットまたはシャーディングされたクラスター上のコレクションのクエリ サンプリングを構成します。 サンプリングされたクエリは、シャードキーの読み取りと書込みの分布に関するメトリクスを計算するための情報をanalyzeShardKeyに提供します。

db.collection.configureQueryAnalyzer() メソッドは、configureQueryAnalyzer コマンドをラップします。

次の値を返します。A document containing fields describing the old configuration, if one exists, and fields describing the new configuration. For details, see 出力.

このメソッドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです

重要

このコマンドは、M0、M2、M5、および Flex クラスターではサポートされていません。詳細については、「 サポートされていないコマンド 」を参照してください。

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

このメソッドの構文は次のとおりです。

db.collection.configureQueryAnalyzer(
{
mode: <string>,
samplesPerSecond: <double>
}
)

db.collection.configureQueryAnalyzer()には次のフィールドがあります:

フィールド
タイプ
必要性
説明

mode

string

必須

クエリ アナライザが実行されるモード。 "full"または"off"のいずれかに設定する必要があります。

samplesPerSecond

double

任意

1 秒あたりのサンプル数。

  • mode"full"に設定されている場合、 samplesPerSecond050の間で設定する必要があります。

  • mode"off"に設定されている場合、サーバーはsamplesPerSecondを無視します。

For details, see samplePerSeconds の上限.

For details, see configureQueryAnalyzer Access Control.

For behavior, see configureQueryAnalyzer Behavior.

For details, see configureQueryAnalyzer Output.

For examples, see configureQueryAnalyzer Examples.