定義
currentOpバージョン 6.2 から非推奨。
バージョン 6.2 以降では
$currentOp集計ステージが使用されます。インスタンスに対して進行中の操作に関する情報を含む ドキュメント
mongodを返します。currentOp6データベースコマンドは、バージョン.2$currentOpcurrentOp以降では非推奨です。 コマンドとそのmongoshヘルパーメソッドdb.currentOp()の代わりに、 集計ステージを使用します。
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- MongoDB Atlas はクラウドでの MongoDB 配置のための完全管理サービスです
注意
このコマンドは、すべての MongoDB Atlas クラスターでサポートされています。すべてのコマンドに対する Atlas のサポートについては、「サポートされていないコマンド」を参照してください。
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
このコマンドの構文は、次のとおりです。
db.adminCommand( { currentOp: 1 } )
注意
MongoDB5.0 以降では、ヘルパーメソッド$currentOp db.currentOp()をmongosh で実行中ときに 集計ステージが使用されます。
これを考慮すると、shell の 5.0 バージョンと mongosh では、 db.currentOp()の結果セットは、前のレガシーmongoバージョンのドキュメントの 16 MB のBSON ドキュメント戻りサイズ 制限を受けません。
動作
currentOp はadminデータベースに対して実行する必要があり、いくつかのオプション フィールドを受け入れることができます。
フィールド | 説明 |
|---|---|
| ブール値。
|
| ブール値。
|
<filter> | |
| 任意。このコマンドに添付するユーザー指定のコメント。設定すると、このコメントは以下の場所にこのコマンドの記録と合わせて表示されます。
コメントには、有効な BSON 型(string, integer, object, array など)を使用できます。 |
currentOp とデータベースプロファイラーがCRUD操作について報告する基本的な診断情報は同じで、次のようなものがあります。
getMore(OP_GET_MORE とcommand)
これらの操作は低速クエリのログにも含まれます。 低速クエリ ロギングの詳細については、 slowOpThresholdMsを参照してください。
編集
Queryable Encryptionを使用する場合、 encryptionInformationオプションを使用したcurrentOp操作によって特定の情報がリダクションされます。
出力では、
"command"以降のすべてのフィールドが省略されます。出力では、
"command"が最初の要素である$commentと$dbのみを含むように編集されます。
アクセス制御
authorization で実行されているシステムでは、ユーザーに inprog 特権アクションを含むアクセス権が必要です。
ユーザーはmongodインスタンスで$ownOpsを使用して、 inprog特権アクションなしで自分の操作を表示できます。
db.adminCommand( { currentOp: 1, "$ownOps": 1 } )
例
次の例では、さまざまなクエリ ドキュメントでcurrentOpコマンドを使用して出力をフィルタリングします。
現在のすべての操作の表示
db.adminCommand( { currentOp: true, "$all": true } )
ロックを待機する書込み (write) 操作
次の例では、ロックを待機しているすべての書込み (write) 操作に関する情報を返します。
db.adminCommand( { currentOp: true, "waitingForLock" : true, $or: [ { "op" : { "$in" : [ "insert", "update", "remove" ] } }, { "command.findandmodify": { $exists: true } } ] } )
中断のないアクティブな操作
次の例では、実行中のアクティブな操作のうち、中断していないすべての操作に関する情報を返します。
db.adminCommand( { currentOp: true, "active" : true, "numYields" : 0, "waitingForLock" : false } )
特定のデータベースに対するアクティブな操作
次の例では、3 秒以上実行されているデータベース db1 のすべてのアクティブな操作に関する情報を返します。
db.adminCommand( { currentOp: true, "active" : true, "secs_running" : { "$gt" : 3 }, "ns" : /^db1\./ } )
アクティブなインデックス操作
次の例では、インデックスの作成操作に関する情報を返します。
db.getSiblingDB("admin").aggregate( [ { $currentOp : { idleConnections: true } }, { $match: { $or: [ { "op": "command", "command.createIndexes": { $exists: true } }, { "op": "none", "msg": /^Index Build/ } ] } } ] )
MongoDB は、activeフィールドを false に設定することで、コミットクォーラムを待機しているインデックスをアイドル接続としてマークします。idleConnections: true 設定では、これらのアイドル接続が $currentOp 出力に含まれます。
出力例
The following is a prototype of the currentOp output when run on a standalone:
{ "inprog": [ { "type" : <string>, "host" : <string>, "desc" : <string>, "connectionId" : <number>, "client" : <string>, "appName" : <string>, "clientMetadata" : <document>, "active" : <boolean>, "currentOpTime" : <string>, "effectiveUsers" : [ { "user" : <string>, "db" : <string> } ], "opid" : <number>, "lsid" : { "id" : <UUID>, "uid" : <BinData> }, "secs_running" : <Long()>, "microsecs_running" : <number>, "op" : <string>, "ns" : <string>, "command" : <document>, "queryFramework" : <string>, "planSummary": <string>, "cursor" : { // only for getMore operations "cursorId" : <Long()>, "createdDate" : <ISODate()>, "lastAccessDate" : <ISODate()>, "nDocsReturned" : <Long()>, "nBatchesReturned" : <Long()>, "noCursorTimeout" : <boolean>, "tailable" : <boolean>, "awaitData" : <boolean>, "originatingCommand" : <document>, "planSummary" : <string>, "operationUsingCursorId" : <Long()> }, "msg": <string>, "progress" : { "done" : <number>, "total" : <number> }, "killPending" : <boolean>, "numYields" : <number>, "dataThroughputLastSecond" : <number>, "dataThroughputAverage" : <number>, "waitingForLatch" : { "timestamp" : <ISODate()>, "captureName" : <string> }, "locks" : { "ParallelBatchWriterMode" : <string>, "ReplicationStateTransition" : <string>, "Global" : <string>, "Database" : <string>, "Collection" : <string>, "Metadata" : <string>, "oplog" : <string> }, "waitingForLock" : <boolean>, "lockStats" : { "ParallelBatchWriterMode" : { "acquireCount": { "r": <NumberLong>, "w": <NumberLong>, "R": <NumberLong>, "W": <NumberLong> }, "acquireWaitCount": { "r": <NumberLong>, "w": <NumberLong>, "R": <NumberLong>, "W": <NumberLong> }, "timeAcquiringMicros" : { "r" : Long(0), "w" : Long(0), "R" : Long(0), "W" : Long(0) }, "deadlockCount" : { "r" : Long(0), "w" : Long(0), "R" : Long(0), "W" : Long(0) } }, "ReplicationStateTransition" : { ... }, "Global": { ... }, "Database" : { ... }, ... } }, ... ], "fsyncLock": <boolean>, "info": <string>, "ok": <num> }
The following is a prototype of the currentOp output when run on a primary of a replica set:
{ "inprog": [ { "type" : <string>, "host" : <string>, "desc" : <string>, "connectionId" : <number>, "client" : <string>, "appName" : <string>, "clientMetadata" : <document>, "lsid" : { "id" : <UUID>, "uid" : <BinData> }, "transaction" : { "parameters" : { "txnNumber" : <Long()>, "autocommit" : <boolean>, "readConcern" : { "level" : <string> } }, "readTimestamp" : <Timestamp>, "startWallClockTime" : <string>, "timeOpenMicros" : <Long()>, "timeActiveMicros" : <Long()>, "timeInactiveMicros" : <Long()>, "expiryTime" : <string>, }, "active" : <boolean>, "currentOpTime" : <string>, "effectiveUsers" : [ { "user" : <string>, "db" : <string> } ], "opid" : <number>, "secs_running" : <Long()>, "microsecs_running" : <number>, "op" : <string>, "ns" : <string>, "command" : <document>, "originatingCommand" : <document>, "queryFramework" : <string>, "planSummary": <string>, "prepareReadConflicts" : <Long()>, "writeConflicts" : <Long()>, "cursor" : { // only for getMore operations "cursorId" : <Long()>, "createdDate" : <ISODate()>, "lastAccessDate" : <ISODate()>, "nDocsReturned" : <Long()>, "nBatchesReturned" : <Long()>, "noCursorTimeout" : <boolean>, "tailable" : <boolean>, "awaitData" : <boolean>, "originatingCommand" : <document>, "planSummary" : <string>, "operationUsingCursorId" : <Long()> }, "msg": <string>, "progress" : { "done" : <number>, "total" : <number> }, "killPending" : <boolean>, "numYields" : <number>, "dataThroughputLastSecond" : <number>, "dataThroughputAverage" : <number>, "waitingForLatch" : { "timestamp" : <ISODate()>, "captureName" : <string> }, "locks" : { "ParallelBatchWriterMode" : <string>, "ReplicationStateTransition" : <string>, "Global" : <string>, "Database" : <string>, "Collection" : <string>, "Metadata" : <string>, "oplog" : <string> }, "waitingForLock" : <boolean>, "lockStats" : { "ParallelBatchWriterMode" : { "acquireCount": { "r": <NumberLong>, "w": <NumberLong>, "R": <NumberLong>, "W": <NumberLong> }, "acquireWaitCount": { "r": <NumberLong>, "w": <NumberLong>, "R": <NumberLong>, "W": <NumberLong> }, "timeAcquiringMicros" : { "r" : Long(0), "w" : Long(0), "R" : Long(0), "W" : Long(0) }, "deadlockCount" : { "r" : Long(0), "w" : Long(0), "R" : Long(0), "W" : Long(0) } }, "ReplicationStateTransition" : { ... }, "Global" : { ... }, "Database" : { ... }, ... } }, ... ], "fsyncLock": <boolean>, "info": <string>, "ok": <num>, "operationTime": <timestamp>, "$clusterTime": <document> }
The following is an example of the currentOp output when run on a mongos of a sharded cluster (Fields may vary depending on the operation being reported):
{ "inprog": [ { "shard": <string>, "type" : <string>, "host" : <string>, "desc" : <string>, "connectionId" : <number>, "client_s" : <string>, "appName" : <string>, "clientMetadata" : <document>, "lsid" : { "id" : <UUID>, "uid" : <BinData> }, "transaction" : { "parameters" : { "txnNumber" : <Long()>, "autocommit" : <boolean>, "readConcern" : { "level" : <string> } }, "readTimestamp" : <Timestamp>, "startWallClockTime" : <string>, "timeOpenMicros" : <Long()>, "timeActiveMicros" : <Long()>, "timeInactiveMicros" : <Long()>, "expiryTime" : <string>, }, "active" : <boolean>, "currentOpTime" : <string>, "effectiveUsers" : [ { "user" : <string>, "db" : <string> } ], "runBy" : [ { "user" : <string>, "db" : <string> } ], "twoPhaseCommitCoordinator" : { "lsid" : { "id" : <UUID>, "uid" : <BinData> }, "txnNumber" : <NumberLong>, "numParticipants" : <NumberLong>, "state" : <string>, "commitStartTime" : <ISODate>, "hasRecoveredFromFailover" : <boolean>, "stepDurations" : <document>, "decision" : <document>, "deadline" : <ISODate> } "opid" : <string>, "secs_running" : <Long()>, "microsecs_running" : <number>, "op" : <string>, "ns" : <string>, "command" : <document>, "configTime" : <Timestamp>, // Starting in 5.0 "topologyTime" : <Timestamp>, // Starting in 5.0 "queryFramework" : <string>, // Starting in 6.2 "planSummary": <string>, "prepareReadConflicts" : <Long()>, "writeConflicts" : <Long()>, "cursor" : { // only for getMore operations "cursorId" : <Long()>, "createdDate" : <ISODate()>, "lastAccessDate" : <ISODate()>, "nDocsReturned" : <Long()>, "nBatchesReturned" : <Long()>, "noCursorTimeout" : <boolean>, "tailable" : <boolean>, "awaitData" : <boolean>, "originatingCommand" : <document>, "planSummary" : <string>, "operationUsingCursorId" : <Long()> }, "msg": <string>, "progress" : { "done" : <number>, "total" : <number> }, "killPending" : <boolean>, "numYields" : <number>, "dataThroughputLastSecond" : <number>, "dataThroughputAverage" : <number>, "waitingForLatch" : { "timestamp" : <ISODate()>, "captureName" : <string> }, "locks" : { "ParallelBatchWriterMode" : <string>, "ReplicationStateTransition" : <string>, "Global" : <string>, "Database" : <string>, "Collection" : <string>, "Metadata" : <string>, "oplog" : <string> }, "waitingForLock" : <boolean>, "lockStats" : { "ParallelBatchWriterMode": { "acquireCount": { "r": <NumberLong>, "w": <NumberLong>, "R": <NumberLong>, "W": <NumberLong> }, "acquireWaitCount": { "r": <NumberLong>, "w": <NumberLong>, "R": <NumberLong>, "W": <NumberLong> }, "timeAcquiringMicros" : { "r" : Long(0), "w" : Long(0), "R" : Long(0), "W" : Long(0) }, "deadlockCount" : { "r" : Long(0), "w" : Long(0), "R" : Long(0), "W" : Long(0) } }, "ReplicationStateTransition" : { ... }, "Global" : { ... }, "Database" : { ... }, ... } }, ... ], "ok": <num>, "operationTime": <timestamp>, "$clusterTime": <document> }
具体的な出力例
これらの出力サンプルは、特定の操作に対する currentOp 出力を示しています。実際の出力を構成するフィールドは、サーバーのロールによって異なります。
リシャーディング出力の例
{ type: "op", desc: "Resharding{Donor, Recipient, Coordinator}Service <reshardingUUID>", op: "command", ns: "<database>.<collection>", originatingCommand: { reshardCollection: "<database>.<collection>", key: <shardkey>, unique: <boolean>, collation: {locale: "simple"}, // Other options to the reshardCollection command are omitted // to decrease the likelihood the output is truncated. }, {donor, coordinator, recipient}State : "<service state>", approxDocumentsToCopy: NumberLong(<count>), approxBytesToCopy: NumberLong(<count>), bytesCopied: NumberLong(<count>), countWritesToStashCollections: NumberLong(<count>), countWritesDuringCriticalSection : NumberLong(<count>), countReadsDuringCriticalSection: NumberLong(<count>), deletesApplied: NumberLong(<count>), documentsCopied: NumberLong(<count>), insertsApplied: NumberLong(<count>), oplogEntriesFetched: NumberLong(<count>), oplogEntriesApplied: NumberLong(<count>), remainingOperationTimeEstimatedSecs: NumberLong(<count>), allShardsLowestRemainingOperationTimeEstimatedSecs: NumberLong(<estimate>), allShardsHighestRemainingOperationTimeEstimatedSecs: NumberLong(<estimate>), totalApplyTimeElapsedSecs: NumberLong(<count>), totalCopyTimeElapsedSecs: NumberLong(<count>), totalCriticalSectionTimeElapsedSecs : NumberLong(<count>), totalOperationTimeElapsedSecs: NumberLong(<count>), updatesApplied: NumberLong(<count>), }
グローバルインデックスの例
{ type: "op", desc: "GlobalIndex{Donor, Recipient, Coordinator}Service <globalIndexUUID}", op: "command", ns: "<database>.<collection>", originatingCommand: { createIndexes: "<database>.<collection>", key: <indexkeypattern>, unique: <boolean>, <Additional createIndexes options> }, {donor, coordinator, recipient}State : "<service state>", approxDocumentsToScan: Long(<count>), approxBytesToScan: Long(<count>), bytesWrittenFromScan: Long(<count>), countWritesToStashCollections: Long(<count>), countWritesDuringCriticalSection : Long(<count>), countReadsDuringCriticalSection: Long(<count>), keysWrittenFromScan: Long(<count>), remainingOperationTimeEstimatedSecs: Long(<count>), allShardsLowestRemainingOperationTimeEstimatedSecs: Long(<estimate>), allShardsHighestRemainingOperationTimeEstimatedSecs: Long(<estimate>), totalCopyTimeElapsedSecs: Long(<count>), totalCriticalSectionTimeElapsedSecs : Long(<count>), totalOperationTimeElapsedSecs: Long(<count>), }
出力フィールド
currentOp.type操作の種類。 値は次のいずれかです。
opidleSessionidleCursor
If the
currentOp.typeisop,currentOp.opprovides details on the specific operation.
currentOp.descA description of the client. This string includes the
connectionId.
currentOp.client操作が発生した場所に関する情報を含む string。
For multi-document transactions,
clientstores information about the most recent client to run an operation inside the transaction.
currentOp.appName操作を実行したクライアント・アプリケーションの識別子。
appName接続stringオプションを使用して、appNameフィールドにカスタム値を設定します。
currentOp.clientMetadataクライアントに関する追加情報。
For multi-document transactions,
clientstores information about the most recent client to run an operation inside the transaction.
currentOp.runByAn array that contains a document for each user who is impersonating the
effectiveUser(s)for the operation. The runBy document contains theusername and the authenticationdb. In general, the runBy user is the__systemuser; e.g."runBy" : [ { "user" : "__system", "db" : "local" } ] シャーディングされたクラスターでのみ利用可能
currentOp.transactionマルチドキュメントトランザクション情報を含むドキュメント。
操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.parametersマルチドキュメントトランザクションに関する情報を含むドキュメント。
操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.parameters.autocommitトランザクションでオートコミットがオンになっているかどうかを示すブール値のフラグ。
操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.parameters.readConcernトランザクションの読み取り保証( read concern )です。
マルチドキュメントトランザクションは、読み取り保証(read concern)
"snapshot"、"local"、"majority"をサポートします。操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.readTimestampトランザクション内の操作によって読み取られるスナップショットのタイムスタンプ。
操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.startWallClockTimeトランザクションが開始された日時(タイムゾーン)。
操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.timeOpenMicrosトランザクションの期間(マイクロ秒単位)。
The
timeActiveMicrosvalue added to thetimeInactiveMicrosshould equal thetimeOpenMicros.操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.timeActiveMicrosトランザクションがアクティブになっている合計時間。つまり、トランザクションで操作が実行されていた場合を指します。
The
timeActiveMicrosvalue added to thetimeInactiveMicrosshould equal thetimeOpenMicros.操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.timeInactiveMicrosトランザクションが非アクティブであった合計時間。トランザクションで実行中の操作がない場合。
The
timeInactiveMicrosvalue added to thetimeActiveMicrosshould equal thetimeOpenMicros.操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.transaction.expiryTimeトランザクションがタイムアウトして中止される日時(タイムゾーンあり)。
The
currentOp.transaction.expiryTimeequals thecurrentOp.transaction.startWallClockTime+ thetransactionLifetimeLimitSeconds.詳細については、「 トランザクションの実行時間制限 」を参照してください。
操作がマルチドキュメントトランザクションの一部である場合にのみ存在します。
currentOp.twoPhaseCommitCoordinator次のいずれかに関する情報
書込み (write) 操作が複数のシャードにまたがるトランザクションのコミット調整メトリクス。
コミット調整はシャードによって処理され、
currentOp(mongosまたはシャード ノードで実行)は、そのシャードによって現在調整されているトランザクションについてのみシャードの調整情報を返します。コミット調整メトリクスのみをフィルタリングするには:
db.currentOp( { desc: "transaction coordinator" }) A specific commit coordination operation (i.e.
currentOp.typeisopandcurrentOp.descis"TransactionCoordinator") spawned by the transaction coordinator.
currentOp.twoPhaseCommitCoordinator.lsidマルチシャード トランザクションのセッション識別子。
The combination of the
lsidandtxnNumberidentifies the transaction.
currentOp.twoPhaseCommitCoordinator.txnNumberマルチシャード トランザクションのトランザクション番号。
The combination of the
txnNumberandlsididentifies the transaction.
currentOp.twoPhaseCommitCoordinator.actionトランザクションの調整役によって生成される特定のコミット調整操作は、以下のとおりです。
"sendingPrepare""sendingCommit""sendingAbort""writingParticipantList""writingDecision""deletingCoordinatorDoc"
特定の調整操作でのみ使用できます。
currentOp.twoPhaseCommitCoordinator.startTimeThe start date and time of the
action.特定の調整操作でのみ使用できます。
currentOp.twoPhaseCommitCoordinator.numParticipantsこのコミットに参加したシャードの数。
コミット調整メトリクスでのみ使用できます。
currentOp.twoPhaseCommitCoordinator.stateコミット調整プロセスの現在のステップまたは状態。
ステップ/ステージ説明inactiveコミットのアクティブな一部ではない。
writingParticipantListこのマルチシャード トランザクションの一部であるシャードのリストをローカル レコードで書込み (write) ます。
waitingForVotes参加者がコミットまたは中止への投票で応答するまで待機します。
writingDecision投票に基づいてコミットまたは中止するかどうかのコーディネーターの決定をローカル レコードで書き込みます。
waitingForDecisionAckコーディネーターのコミットまたは中止の決定を確認するまで、参加者が待機します。
deletingCoordinatorDocコミット決定のローカル レコードを削除します。
コミット調整メトリクスでのみ使用できます。
currentOp.twoPhaseCommitCoordinator.commitStartTimeコミットが開始された日時。
コミット調整メトリクスでのみ使用できます。
currentOp.twoPhaseCommitCoordinator.hasRecoveredFromFailoverコミットを調整しているシャードで フェイルオーバー によりコミット調整が再開されたかどうかを示すブール値。
If
hasRecoveredFromFailoveris true, then the times specified incurrentOp.twoPhaseCommitCoordinator.stepDurationsmay not be accurate for all steps.コミット調整メトリクスでのみ使用できます。
currentOp.twoPhaseCommitCoordinator.stepDurationsA document that contains the duration, in microseconds, of the commit coordination
steps/statecompleted or in progress:"stepDurations" : { "writingParticipantListMicros" : Long(17801), "totalCommitDurationMicros" : Long(42488463), "waitingForVotesMicros" : Long(30378502), "writingDecisionMicros" : Long(15015), "waitingForDecisionAcksMicros" : Long(12077145), "deletingCoordinatorDocMicros" : Long(6009) }, If
currentOp.twoPhaseCommitCoordinator.hasRecoveredFromFailoveris true, then the times specified instepDurationsmay not be accurate for all steps.inactive状態のコーディネーターの場合、ドキュメントは空です。"stepDurations" : { } コミット調整メトリクスでのみ使用できます。
currentOp.twoPhaseCommitCoordinator.decisionコミットまたは中止の決定を含むドキュメント。例:
コミットの決定を行うには:
"decision" : { "decision" : "commit", "commitTimestamp" : Timestamp(1572034669, 3) } 中止の決定を行うには:
"decision" : { "decision" : "abort", "abortStatus" : { "code" : 282, "codeName" : "TransactionCoordinatorReachedAbortDecision", "errmsg" : "Transaction exceeded deadline" } }
コミット調整メトリクスでのみ使用できます。
currentOp.twoPhaseCommitCoordinator.deadlineコミットが完了する必要がある日時。
コミット調整メトリクスでのみ使用できます。
currentOp.opidThe identifier for the operation. You can pass this value to
db.killOp()inmongoshto terminate the operation.警告
実行中の操作は、細心の注意を払って終了します。 クライアントによって開始された操作を終了するには
db.killOp()のみを使用し、内部データベース操作は終了しません。
currentOp.active操作が開始されたかどうかを指定するブール値。 値は、操作が開始された場合は
trueで、操作がアイドル状態(アイドル接続や現在アイドル状態の内部スレッドなど)の場合はfalseです。 操作が別の操作に中断された場合でも、操作をアクティブにすることができます。 非アクティブなsignalProcessingThreadなどの一部の非アクティブなバックグラウンド スレッドの場合、MongoDB はさまざまな空のフィールドを抑制します。
currentOp.secs_running操作の期間(秒単位)。 MongoDB は、操作の開始時刻から現在の時刻を減算してこの値を計算します。
Only appears if the operation is running; i.e. if
activeistrue.
currentOp.microsecs_running操作の継続時間(マイクロ秒単位)。 MongoDB は、操作の開始時刻から現在の時刻を減算してこの値を計算します。
Only appears if the operation is running; i.e. if
activeistrue.
currentOp.opA string that identifies the specific operation type. Only present if
currentOp.typeisop.可能な値は次のとおりです。
"none""update""insert""query""command""getmore""remove""killcursors"
"query"操作には、読み取り操作が含まれます。"command"操作には、 やcreateIndexesなどのほとんどの コマンドfindAndModifyが含まれます。
currentOp.ns操作の対象となる名前空間。 名前空間は、データベース名とコレクション名をドットで連結したもの(
.)で構成されています。つまり、"<database>.<collection>"です。
currentOp.commandこの操作に関連付けられた完全なコマンドオブジェクトを含むドキュメント。
たとえば、次の出力には、
testという名前のデータベース内のitemsという名前のコレクションに対するfind操作のコマンド オブジェクトが含まれています。"command" : { "find" : "items", "filter" : { "sku" : 1403978 }, ... "$db" : "test" } 次の出力例には、
testという名前のデータベース内のitemsという名前のコレクションで、カーソル ID19234103609を持つ コマンドによって生成されたgetMore操作のコマンド オブジェクトが含まれています。"command" : { "getMore" : Long("19234103609"), "collection" : "items", "batchSize" : 10, ... "$db" : "test" }, コマンド ドキュメントが 1 キロバイトを超える場合、ドキュメントの形式は次のようになります。
"command" : { "$truncated": <string>, "comment": <string> } $truncatedフィールドには、ドキュメントのcommentフィールド(存在する場合)を除いたドキュメントの string のサマリーが含まれます。 サマリーが依然として 1 キロバイトを超える場合は、さらに切り捨てられ、string の末尾に省略記号 (...) が表示されます。操作にコメントが渡された場合、
commentフィールドが存在します。任意のデータベースコマンドにコメントを添付できます。
currentOp.planSummaryカーソルがコレクションスキャン(
COLLSCAN)またはインデックススキャン(IXSCAN { ... })のどちらを使用するかを指定します。IXSCANには、使用されるインデックスの仕様ドキュメントも含まれます。
currentOp.prepareReadConflicts現在の操作が、コミットまたは中止するための書込み (write) で準備されたトランザクションを待機しなければならなかった回数。
待機中も、現在の操作は必要なロックとストレージ エンジン リソースを保持し続けます。
currentOp.cursorA document that contains the cursor information for
getmoreoperations; i.e. whereopisgetmore.If reporting on a
getmoreoperation before thegetmorehas accessed its cursor information, thecursorfield is not available.currentOp.cursor.noCursorTimeoutアイドル状態の場合、カーソルがタイムアウトしないことを示すフラグ。 (つまり、カーソルに
noTimeoutオプションが設定されている場合)。true の場合、アイドル状態のときにカーソルはタイムアウトしません。
false の場合、アイドル状態のときにカーソルはタイムアウトになります。
currentOp.cursor.tailableカーソルがCappedコレクションの 追尾可能 (tailable) カーソル かどうかを示すフラグ。 クライアントが初期カーソルの結果を使い果たした後も、追尾可能 (tailable) カーソルはオープンしたままになります。
currentOp.cursor.awaitData追尾可能 (tailable) カーソルが、データを返さずに新しいデータを待機している間に、カーソル上の
getMoreコマンドを一時的にブロックするかどうかを示すフラグ。追尾可能 (tailable) ではないカーソルの場合、値は常に false です。
currentOp.cursor.originatingCommandoriginatingCommandフィールドには完全なコマンドオブジェクト(例:findまたはaggregate)が必要です。
currentOp.waitingForLatchThe
waitingForLatchdocument is only available if the operation is waiting to acquire an internal locking primitive (a.k.a. a latch) or for an internal condition to be met.たとえば、
"waitingForLatch" : { "timestamp" : ISODate("2020-03-19T23:25:58.412Z"), "captureName" : "FutureResolution", }, 出力フィールド説明タイムスタンプ
操作が待機を開始した日時。
acceptName
操作が現在ブロックされているセクションの内部名。
バージョン4.2.2の新機能。
currentOp.locksThe
locksdocument reports the type and mode of locks the operation currently holds. The possible lock types are as follows:ロック タイプ説明ParallelBatchWriterMode並列バッチ書込みモードのロックを表します。
以前のバージョンでは、PBWM 情報は
Globalロック情報の一部として報告されていました。ReplicationStateTransitionレプリカセットの状態遷移に対して取得されたロックを表します。
Globalグローバル ロックを表します。
Databaseデータベース ロックを表します。
Collectionコレクション ロックを表します。
Mutexミューテックスを表します。
Metadataメタデータ ロックを表します。
oplogoplog のロックを表します。
使用可能なモードは次のとおりです。
ロックモード説明R共有ロック(S)を表します。
W排他ロック(X)を表します。
rインテント共有ロック(IS)を表します。
wインテント排他ロック(IX)を表します。
currentOp.admissionPriority内部でのみ使用します。 値は、ストレージ エンジンのアクションを実行するためにチケットを取得しようとする際の操作の優先順位です。
可能な値は、「低」、「標準」、および「即座」です。 「低」値を持つ操作のみが報告されます。
currentOp出力の例:{ type: 'op', host: 'ip-10-122-5-147:27017', desc: 'JournalFlusher', active: true, currentOpTime: '2022-10-11T12:45:52.053+00:00', opid: 201, op: 'none', ns: '', command: {}, numYields: 0, admissionPriority: 'low', locks: {}, waitingForLock: false, lockStats: {}, waitingForFlowControl: false, flowControlStats: {} } admissionPriority値も低速ログで報告されます。バージョン6.3の新機能。
currentOp.waitingForLockReturns a boolean value.
waitingForLockistrueif the operation is waiting for a lock andfalseif the operation has the required lock.
currentOp.msgThe
msgprovides a message that describes the status and progress of the operation. In the case of indexing or mapReduce operations, the field reports the completion percentage.
currentOp.progressReports on the progress of mapReduce or indexing operations. The
progressfields corresponds to the completion percentage in themsgfield. Theprogressspecifies the following information:
currentOp.numYieldsnumYieldsは、他の操作を完了させるために操作が中断した回数を報告するカウンターです。通常、MongoDB がまだ完全にメモリに読み込んでいないデータにアクセスする必要がある場合、操作は中断します。 これにより、MongoDB が中断された操作のデータを読み込んでいる間に、メモリにデータがある他の操作を迅速に完了できます。
currentOp.dataThroughputLastSecond過去 1 秒に
validate操作によって処理されたデータの量(MiB 単位)。 現在ドキュメントをスキャンしているvalidate操作でのみ使用できます。 例:"msg" : "Validate: scanning documents Validate: scanning documents: 7258/24000 30%", "progress" : { "done" : 7258, "total" : 24000 }, "numYields" : 0, "dataThroughputLastSecond" : 15.576952934265137, "dataThroughputAverage" : 15.375944137573242,
currentOp.dataThroughputAveragevalidate操作によって処理された平均データ量(MiB 単位)。 現在ドキュメントをスキャンしているvalidate操作でのみ使用できます。 例:"msg" : "Validate: scanning documents Validate: scanning documents: 7258/24000 30%", "progress" : { "done" : 7258, "total" : 24000 }, "numYields" : 0, "dataThroughputLastSecond" : 15.576952934265137, "dataThroughputAverage" : 15.375944137573242,
currentOp.fsyncLockデータベースが現在
fsync write/snapshotに対してロックされているかどうかを指定します。Only appears if locked; i.e. if
fsyncLockistrue.
currentOp.infoInformation regarding how to unlock database from
db.fsyncLock(). Only appears iffsyncLockistrue.
currentOp.lockStatsFor each lock type and mode (see
currentOp.locksfor descriptions of lock types and modes), returns the following information:currentOp.lockStats.acquireWaitCountNumber of times the operation had to wait for the
acquireCountlock acquisitions because the locks were held in a conflicting mode.acquireWaitCountis less than or equal toacquireCount.
currentOp.lockStats.timeAcquiringMicros操作がロックを取得するために待機しなければならなかった累計時間(マイクロ秒単位)。
timeAcquiringMicrosdivided byacquireWaitCountgives an approximate average wait time for the particular lock mode.
currentOp.totalOperationTimeElapsedSecs現在のリシャーディング操作の合計経過時間(秒単位)。 新たにリシャーディング操作を開始すると、時間は 0 に設定されます。
リシャーディング操作 が行われている場合にのみ存在します。
バージョン 5.0 の新機能。
MongoDB 6.1 以降では、このメトリクスはリシャーディング中に コーディネーターでも使用できます。
currentOp.remainingOperationTimeEstimatedSecsremainingOperationTimeEstimatedSecs: 現在のリシャーディング操作の推定残り時間(秒単位)。 新たにリシャーディング操作を開始すると、-1として返されます。次以降:
MongoDB 5.0 および MongoDB 6.1 より前では、
remainingOperationTimeEstimatedSecsは 再シャーディング操作 中に受信者シャードでのみ使用できます。MongoDB 6.1、
remainingOperationTimeEstimatedSecsは、リシャーディング操作中にコーディネーターで使用することもできます。
リシャーディング操作では、これらのフェーズを順番に実行されます。
クローン フェーズは、現在のコレクション データを複製します。
キャッチアップ フェーズは、保留中の書込み (write) 操作をリシャーディングされたコレクションに適用します。
remainingOperationTimeEstimatedSecsは悲観的な時間推定値に設定されています。キャッチアップフェーズの推定時間は、比較的長い時間であるクローンフェーズ時間に設定されます。
実際には、保留中の書込み操作が少ない場合、実際のキャッチアップ フェーズ時間は比較的短いです。
バージョン 5.0 の新機能。
currentOp.allShardsLowestRemainingOperationTimeEstimatedSecs全シャードに渡って計算された、推定される残り秒数の最小値です。
リシャーディング操作が行われているときにのみ、コーディネーターに存在します。
バージョン6.1の新機能。
currentOp.allShardsHighestRemainingOperationTimeEstimatedSecs全シャードにわたって計算された、推定される残り秒数の最高値。
リシャーディング操作が行われているときにのみ、コーディネーターに存在します。
バージョン6.1の新機能。
currentOp.approxDocumentsToCopyリシャーディング操作中にドナー シャードから受信者シャードにコピーされるドキュメントのおおよその数です。 この数値は、リシャーディング操作の開始時に設定され、設定された後は変化しない推定値です。 新たにリシャーディング操作を開始すると、数値は 0 に設定されます。 リシャーディング後のデータ分布が完全に均等でない場合、
$currentOp.documentsCopiedと$currentOp.bytesCopiedはそれぞれ$currentOp.approxDocumentsToCopyと$currentOp.approxBytesToCopyを超えてしまう可能性があります。リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
currentOp.documentsCopiedリシャーディング操作中にドナー シャードから受信者シャードにコピーされたドキュメントの数です。 新たにリシャーディング操作を開始すると、数値は 0 に設定されます。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
currentOp.approxBytesToCopyリシャーディング操作中にドナー シャードから受信者シャードにコピーされるおおよそのバイト数。 この数値は、リシャーディング操作の開始時に設定され、設定された後は変化しない推定値です。 新たにリシャーディング操作を開始すると、数値は 0 に設定されます。 リシャーディング後のデータ分布が完全に均等でない場合、
$currentOp.documentsCopiedと$currentOp.bytesCopiedはそれぞれ$currentOp.approxDocumentsToCopyと$currentOp.approxBytesToCopyを超えてしまう可能性があります。リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
currentOp.bytesCopiedリシャーディング操作中にドナー シャードから受信者シャードにコピーされたバイト数です。 新たにリシャーディング操作を開始すると、数値は 0 に設定されます。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
currentOp.countWritesToStashCollections受信者の溜め込みコレクションへの書込み (write) 回数。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン6.1の新機能。
currentOp.countWritesDuringCriticalSectionドナーのクリティカル セクション中に試行された書込み (write) の数。
リシャーディング操作が行われているときにのみ存在します。
バージョン6.1の新機能。
currentOp.countReadsDuringCriticalSectionドナーのクリティカル セクション中に試行された読み取りの数。
リシャーディング操作が行われているときにのみ存在します。
バージョン6.1の新機能。
currentOp.deletesApplied一時的なリシャーディング コレクションに適用された削除の数。 削除を含む oplog エントリごとに、カウンターは 1 ずつ増加します。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン6.1の新機能。
currentOp.insertsApplied一時的なリシャーディング コレクションに適用された挿入の数。 挿入を含む oplog のエントリごとに、カウンターは 1 ずつ増加します。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン6.1の新機能。
currentOp.totalCopyTimeElapsedSecs現在のリシャーディング操作におけるドナー シャードから受信者シャードへの進行中のデータ コピー タスクの合計経過時間(秒単位)。 新たにリシャーディング操作を開始すると、時間は 0 に設定されます。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
MongoDB 6.1 以降では、このメトリクスはリシャーディング中に コーディネーターでも使用できます。
currentOp.oplogEntriesFetched現在の リシャーディング操作 で oplog から取得されたエントリの数です。新たにリシャーディング操作を開始すると、数値は 0 に設定されます。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
currentOp.oplogEntriesApplied現在の リシャーディング操作 で oplog に適用されたエントリの数。新たにリシャーディング操作を開始すると、数値は 0 に設定されます。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
currentOp.totalApplyTimeElapsedSecs現在のリシャーディング操作における適用ステップの合計経過時間(秒単位)です。 適用ステップでは、受信者シャードは、ドナー シャードから新たに受信した書込み (write) に基づいてデータを変更するために、 oplogエントリを適用します。 新たにリシャーディング操作を開始すると、時間は 0 に設定されます。
リシャーディング操作 が行われているときにのみ 受信者シャード に存在します。
バージョン 5.0 の新機能。
MongoDB 6.1 以降では、このメトリクスはリシャーディング中に コーディネーターでも使用できます。
currentOp.countWritesDuringCriticalSection現在のリシャーディング操作でクリティカル セクションにおいて実行された書込み (write) の数。 クリティカル セクションは、リシャーディング中のコレクションへの新規の受信書込み (write) を防止します。 新たにリシャーディング操作を開始すると、数値は 0 に設定されます。
リシャーディング操作が行われているときにのみ存在します。
バージョン 5.0 の新機能。
currentOp.totalCriticalSectionTimeElapsedSecs現在のリシャーディング操作におけるクリティカル セクションの合計経過時間(秒単位)。 クリティカル セクションは、リシャーディング中のコレクションへの新規の受信書込み (write) を防止します。 新たにリシャーディング操作を開始すると、時間は 0 に設定されます。
リシャーディング操作が行われているときにのみ存在します。
バージョン 5.0 の新機能。
MongoDB 6.1 以降では、このメトリクスはリシャーディング中に コーディネーターでも使用できます。
currentOp.donorStateリシャーディング操作におけるドナー シャードの現在の状態です。 新たにリシャーディング操作を開始すると、状態は
unusedに設定されます。リシャーディング操作が行われているときにのみ存在します。
状態説明unusedリシャーディング操作を開始またはプライマリ フェイルオーバーから回復しようとしているとき
preparing-to-donateドナー シャードは、受信者シャードにデータを提供する準備をしています。
donating-initial-dataドナー シャードは受信者シャードにデータを提供します。
donating-oplog-entriesドナー シャードは、受信者シャードに oplog エントリを提供しています。
preparing-to-block-writesドナー シャードは、リシャーディング中のコレクションへの新規の受信書込み (write) 操作を阻止しようとしています。
errorリシャーディング操作中にエラーが発生しました
blocking-writesドナー シャードは新規の受信書込み (write) 操作を防ぎ、新規の受信書込み (write) が禁止されていることをすべての受信者シャードに通知しました。
doneドナー シャードは古いシャーディングされたコレクションを削除し、リシャーディング操作は完了しました。
バージョン 5.0 の新機能。
currentOp.recipientStateリシャーディング操作 における受信者シャードの現在の状態です。 新たにリシャーディング操作を開始すると、状態は
unusedに設定されます。リシャーディング操作が行われているときにのみ存在します。
状態説明unusedリシャーディング操作を開始またはプライマリ フェイルオーバーから回復しようとしているとき
awaiting-fetch-timestamp受信シャードは、ドナー シャードがデータを提供する準備ができるのを待っています。
creating-collection受信者シャードは新しいシャーディングされたコレクションを作成しています。
cloning受信者シャードはドナー シャードからデータを受信しています。
applying受信者シャードは、ドナー シャードからの新規受信書込み (write) に基づいてデータのコピーを変更するために、oplog エントリを適用しています。
errorリシャーディング操作中にエラーが発生しました
strict-consistency受信者シャードでは、すべてのデータ変更は一時的なコレクションに保存されます。
doneリシャーディング操作が完了しました。
バージョン 5.0 の新機能。
currentOp.coordinatorState現在のリシャーディング操作におけるリシャーディング コーディネーターの状態です。 リシャーディング コーディネーターは、 コンフィギュレーションサーバーのプライマリで実行される操作です。 新たにリシャーディング操作を開始すると、状態は
unusedに設定されます。調整コンフィギュレーションサーバー上にのみ存在します。
状態説明unusedリシャーディング操作を開始またはプライマリ フェイルオーバーから回復しようとしているとき
initializingリシャーディング コーディネーターは、コーディネーター ドキュメントを
config.reshardingOperationsに挿入し、元のコレクションのconfig.collectionsエントリにreshardingFieldsを追加しました。preparing-to-donateリシャーディング コーディネーター
は一時的なリシャーディング コレクション用の
config.collectionsエントリを作成しました。は新しいシャードキーに基づく範囲に対するエントリを
config.chunksに挿入しました。は新しいシャード キーに関連付けられたすべてのゾーンに対するエントリを
config.tagsに挿入しました。
コーディネーターは、参加シャードにリシャーディング操作を開始するように通知します。その後、コーディネーターはすべてのドナー シャードが
minFetchTimestampを選択し、提供の準備が整うまで待ちます。cloningリシャーディング コーディネーターは、受信者シャードにデータを提供するようドナー シャードに通知します。コーディネーターは、すべての受信者がドナーからのデータの複製を完了させるのを待機します。
applyingリシャーディング コーディネーターは、ドナー シャードから新たに受信した書込み (write) に基づいてデータのコピーを変更するよう、受信者シャードに通知します。コーディネーターは、すべての受信者が oplog エントリの適用を完了させるのを待機します。
blocking-writesリシャーディング コーディネーターは、コレクションへの新たな受信書込み (write) 操作がリシャーディングされないよう、ドナー シャードに通知します。その後、コーディネーターはすべての受信者がすべてのデータ変更を完了させるのを待機します。
abortingリシャーディング操作中に回復不能なエラーが発生したか、
abortReshardCollectionコマンド(またはsh.abortReshardCollection()メソッド)が実行されました。committingリシャーディング コーディネーターは、一時的なリシャーディングコレクションの
config.collectionsエントリを削除します。次に、コーディネーターはrecipientFieldsをソース コレクションのエントリに追加します。バージョン 5.0 の新機能。
currentOp.collUuidこのフィールドは、クエリ サンプリングに関連するドキュメントにのみ表示されます。 詳細については、「サンプル クエリ 」を参照してください。
バージョン7.0の新機能。
currentOp.startTimeクエリのサンプリングが開始された時刻。
このフィールドは、クエリ サンプリングに関連するドキュメントにのみ表示されます。 詳細については、「サンプル クエリ 」を参照してください。
バージョン7.0の新機能。
currentOp.samplesPerSecond1 秒あたりにサンプリングするクエリの最大数。
シャーディングされたクラスターでは、これは
mongosではなくmongodで報告されます。レプリカセットでは、これはmongodで報告されます。このフィールドは、クエリ サンプリングに関連するドキュメントにのみ表示されます。 詳細については、「サンプル クエリ 」を参照してください。
バージョン7.0の新機能。
currentOp.sampledReadsCountサンプリングされた読み取りクエリの数
このフィールドは、クエリ サンプリングに関連するドキュメントにのみ表示されます。 詳細については、「サンプル クエリ 」を参照してください。
バージョン7.0の新機能。
currentOp.sampledWritesCountサンプリングされた書込み (write) クエリの数です。
このフィールドは、クエリ サンプリングに関連するドキュメントにのみ表示されます。 詳細については、「サンプル クエリ 」を参照してください。
バージョン7.0の新機能。
currentOp.sampledReadsBytesサンプリングされた読み取りクエリのサイズ(バイト単位)。
レプリカセットでは、これは
mongodごとに報告されます。シャーディングされたクラスターでは、
--shardsvrmongodについてのみ報告されます。このフィールドは、クエリ サンプリングに関連するドキュメントにのみ表示されます。 詳細については、「サンプル クエリ 」を参照してください。
バージョン7.0の新機能。
currentOp.sampledWritesBytesサンプリングされた書込み (write) クエリのサイズ(バイト単位)。
レプリカセットでは、これは
mongodごとに報告されます。シャーディングされたクラスターでは、
--shardsvrmongodについてのみ報告されます。このフィールドは、クエリ サンプリングに関連するドキュメントにのみ表示されます。 詳細については、「サンプル クエリ 」を参照してください。
バージョン7.0の新機能。