Docs HomeMongoDB Manual

Database Profiler Output数据库探查器输出

The database profiler captures data information about read and write operations, cursor operations, and database commands. 数据库探查器捕获有关读写操作、游标操作和数据库命令的数据信息。To configure the database profile and set the thresholds for capturing profile data, see the Database Profiler section.要配置数据库配置文件并设置捕获配置文件数据的阈值,请参阅数据库探查器部分。

The database profiler writes data in the system.profile collection, which is a capped collection. 数据库探查器在system.profile集合中写入数据,该集合是一个封顶集合To view the profiler's output, use normal MongoDB queries on the system.profile collection.要查看探查器的输出,请在system.profile集合上使用普通的MongoDB查询。

Note

Because the database profiler writes data to the system.profile collection in a database, the profiler profiles some write activity, even for databases that are otherwise read-only.因为数据库探查器将数据写入数据库中的system.profile集合,所以探查器会对一些写入活动进行探查,即使对于只读的数据库也是如此。

currentOp and the database profiler report the same basic diagnostic information for CRUD operations, including the following:和数据库探查器为CRUD操作报告相同的基本诊断信息,包括以下信息:

These operations are also included in the logging of slow queries (see slowOpThresholdMs for more information about slow query logging).这些操作也包含在慢速查询的日志记录中(有关慢速查询日志记录的更多信息,请参阅slowOpThresholdMs)。

When using Queryable Encryption, CRUD operations against encrypted collections are omitted from the system.profile collection. 使用可查询加密时,系统配置文件集合中会省略针对加密集合的CRUD操作。For details, see Redaction.有关详细信息,请参阅Redaction

Starting in MongoDB 4.4, it is no longer possible to perform any operation, including reads, on the system.profile collection from within a transaction.从MongoDB 4.4开始,不再可能在事务中对system.profile集合执行任何操作,包括读取。

Warning

Do not attempt to create a time series collection or view with the name system.profile. 请勿尝试创建名为system.profile的时间序列集合或视图。MongoDB 6.3 and later versions return an IllegalOperation error if you attempt to do so. 如果您尝试这样做,MongoDB 6.3及更高版本会返回一个IllegalOperation错误。Earlier MongoDB versions crash.早期的MongoDB版本崩溃。

Output Fields输出字段

For any single operation, the documents created by the database profiler includes a subset of the following fields. The precise selection of fields in these documents depends on the type of operation.对于任何单个操作,数据库探查器创建的文档都包括以下字段的子集。这些文档中字段的精确选择取决于操作类型。

Note

For the output specific to the version of your MongoDB, refer to the appropriate version of the MongoDB Manual.有关特定于MongoDB版本的输出,请参阅相应版本的MongoDB手册。

system.profile.op

The type of operation. The possible values are:操作的类型。可能的值为:

  • command
  • count
  • distinct
  • geoNear
  • getMore
  • group
  • insert
  • mapReduce
  • query
  • remove
  • update
system.profile.ns

The namespace the operation targets. 操作的目标命名空间Namespaces in MongoDB take the form of the database, followed by a dot (.), followed by the name of the collection.MongoDB中的命名空间采用数据库的形式,后面跟着一个点(.),后面跟着集合的名称。

system.profile.command

A document containing the full command object associated with this operation.包含与此操作关联的完整命令对象的文档。

For example, the following output contains the command object for a find operation on a collection named items in a database named test:例如,以下输出包含对名为test的数据库中名为items的集合执行find操作的命令对象:

"command" : {
"find" : "items",
"filter" : {
"sku" : 1403978
},
...
"$db" : "test"
}

The following example output contains the command object for a getMore operation generated by a command with cursor ID 19234103609 on a collection named items in a database named test:以下示例输出包含getMore操作的命令对象,该操作由游标ID为19234103609的命令在名为test的数据库中的名为items的集合上生成:

"command" : {
"getMore" : NumberLong("19234103609"),
"collection" : "items",
"batchSize" : 10,
...
"$db" : "test"
},

If the command document exceeds 50 kilobytes, the document has the following form:如果命令文档超过50 KB,则该文档具有以下形式:

"command" : {
"$truncated": <string>,
"comment": <string>
}

The $truncated field contains a string summary of the document excluding the document's comment field if present. If the summary still exceeds 50 kilobytes then it is further truncated, denoted by an ellipsis (...) at the end of the string.$truncated字段包含文档的字符串摘要,不包括文档的comment字段(如果存在)。如果摘要仍然超过50 KB,则会进一步截断,由字符串末尾的省略号(…)表示。

The comment field is present if a comment was passed to the operation. 如果将comment传递给操作,则会出现注释字段。Starting in MongoDB 4.4, a comment may be attached to any database command.从MongoDB 4.4开始,任何数据库命令都可以附加注释。

system.profile.originatingCommand

For "getmore" operations which retrieve the next batch of results from a cursor, the originatingCommand field contains the full command object (e.g. find or aggregate) which originally created that cursor.对于从游标检索下一批结果的"getmore"操作,originatingCommand字段包含最初创建该游标的完整命令对象(例如findaggregate)。

system.profile.cursorid

The ID of the cursor accessed by a query and getmore operations.querygetmore操作访问的游标的ID。

system.profile.keysExamined

The number of index keys that MongoDB scanned in order to carry out the operation.MongoDB为了执行操作而扫描的索引键的数量。

In general, if keysExamined is much higher than nreturned, the database is scanning many index keys to find the result documents. 通常,如果keysExaminednreturned高得多,则数据库会扫描许多索引键以查找结果文档。Consider creating or adjusting indexes to improve query performance..请考虑创建或调整索引以提高查询性能。。

keysExamined is available for the following commands and operations:可用于以下命令和操作:

system.profile.docsExamined

The number of documents in the collection that MongoDB scanned in order to carry out the operation.MongoDB为执行操作而扫描的集合中的文档数。

docsExamined is available for the following commands and operations:可用于以下命令和操作:

system.profile.hasSortStage

hasSortStage is a boolean that is true when a query cannot use the ordering in the index to return the requested sorted results; i.e. MongoDB must sort the documents after it receives the documents from a cursor. hasSortStage是一个布尔值,当查询不能使用索引中的排序来返回请求的排序结果时,它为true;即MongoDB必须在从游标接收到文档后对文档进行排序。The field only appears when the value is true.该字段仅在值为true时显示。

hasSortStage is available for the following commands and operations:可用于以下命令和操作:

system.profile.usedDisk

A boolean that indicates whether any aggregation stage wrote data to temporary files due to memory restrictions.一个布尔值,指示是否有任何聚合阶段由于内存限制而将数据写入临时文件。

Only appears if usedDisk is true.仅当usedDisktrue时才会显示。

system.profile.ndeleted

The number of documents deleted by the operation.操作删除的文档数。

system.profile.ninserted

The number of documents inserted by the operation.操作插入的文档数。

system.profile.nMatched

The number of documents that match the query condition for the update operation.与更新操作的查询条件匹配的文档数。

system.profile.nModified

The number of documents modified by the update operation.更新操作修改的文档数。

system.profile.upsert

A boolean that indicates the update operation's upsert option value. Only appears if upsert is true.一个布尔值,指示更新操作的upsert选项值。只有当upserttrue时才会出现。

system.profile.fromMultiPlanner

A boolean that indicates whether the query planner evaluated multiple plans before choosing the winning execution plan for the query.一个布尔值,指示查询计划器在为查询选择获胜执行计划之前是否评估了多个计划。

Only present when value is true.仅当值为true时才出现。

system.profile.replanned

A boolean that indicates whether the query system evicted a cached plan and re-evaluated all candidate plans.一个布尔值,指示查询系统是否收回缓存的计划并重新评估所有候选计划。

Only present when value is true.仅当值为true时才出现。

system.profile.replanReason

New in version 4.4. 4.4版新增。

A string that indicates the specific reason a cached plan was evicted.一个字符串,指示缓存计划被收回的具体原因。

Only present when value for replanned is true.仅在replanned的值为true时出现。

system.profile.keysInserted

The number of index keys inserted for a given write operation.为给定写入操作插入的索引键数。

system.profile.writeConflicts

The number of conflicts encountered during the write operation; e.g. an update operation attempts to modify the same document as another update operation. 写入操作期间遇到的冲突数;例如,update操作试图修改与另一update操作相同的文档。See also write conflict.另请参见写入冲突

system.profile.numYield

The number of times the operation yielded to allow other operations to complete. 操作让步以允许其他操作完成的次数。Typically, operations yield when they need access to data that MongoDB has not yet fully read into memory. 通常情况下,当操作需要访问MongoDB尚未完全读取到内存中的数据时,它们就会屈服。This allows other operations that have data in memory to complete while MongoDB reads in data for the yielding operation. 这允许其他在内存中有数据的操作在MongoDB读取数据进行让步操作时完成。For more information, see the FAQ on when operations yield.有关更多信息,请参阅有关操作何时屈服的常见问题解答

system.profile.queryHash

A hexadecimal string that represents a hash of the query shape and is dependent only on the query shape. queryHash can help identify slow queries (including the query filter of write operations) with the same query shape.十六进制字符串,表示查询形状的哈希,并且仅依赖于查询形状。queryHash可以帮助识别具有相同查询形状的慢速查询(包括写入操作的查询筛选器)。

Note

As with any hash function, two different query shapes may result in the same hash value. However, the occurrence of hash collisions between different query shapes is unlikely.与任何哈希函数一样,两种不同的查询形状可能会产生相同的哈希值。但是,不同查询形状之间不太可能发生哈希冲突。

For more information on queryHash and planCacheKey, see queryHash and planCacheKey.有关queryHashplanCacheKey的更多信息,请参阅queryHashplanCacheKey

system.profile.planCacheKey

A hash of the key for the plan cache entry associated with the query.与查询关联的计划缓存项的键的哈希。

Unlike the queryHash, the planCacheKey is a function of both the query shape and the currently available indexes for that shape. queryHash不同,planCacheKey是查询形状和该形状当前可用索引的函数。That is, if indexes that can support the query shape are added/dropped, the planCacheKey value may change whereas the queryHash value would not change.也就是说,如果添加/删除了可以支持查询形状的索引,planCacheKey值可能会更改,而queryHash值不会更改。

For more information on queryHash and planCacheKey, see queryHash and planCacheKey.有关queryHashplanCacheKey的更多信息,请参阅queryHashplanCacheKey

system.profile.queryFramework

The query framework used to process an operation.用于处理操作的查询框架

system.profile.locks

The system.profile.locks provides information for various lock types and lock modes held during the operation.system.profile.locks提供操作过程中保持的各种锁类型和锁模式的信息。

The possible lock types are:可能的锁类型有:

Lock Type锁定类型Description描述
ParallelBatchWriterModeRepresents a lock for parallel batch writer mode.表示并行批处理写入程序模式的锁。
In earlier versions, PBWM information was reported as part of the Global lock information. 在早期版本中,PBWM信息被报告为Global锁定信息的一部分。
New in version 4.2. 4.2版新增。
ReplicationStateTransitionRepresents lock taken for replica set member state transitions. 表示复制副本集成员状态转换的锁定。
New in version 4.2. 4.2版新增。
GlobalRepresents global lock.表示全局锁。
DatabaseRepresents database lock.表示数据库锁定。
CollectionRepresents collection lock.表示集合锁。
MutexRepresents mutex.表示互斥。
MetadataRepresents metadata lock.表示元数据锁定。
oplogRepresents lock on the oplog.表示操作日志上的锁定。

The possible locking modes for the lock types are as follows:锁类型的可能锁定模式如下:

Lock Mode锁定模式Description描述
RRepresents Shared (S) lock.表示共享(S)锁。
WRepresents Exclusive (X) lock.表示独占(X)锁。
rRepresents Intent Shared (IS) lock.表示意向共享(IS)锁。
wRepresents Intent Exclusive (IX) lock.表示意向独占(IX)锁。

The returned lock information for the various lock types include:返回的各种锁类型的锁信息包括:

system.profile.locks.acquireCount

Number of times the operation acquired the lock in the specified mode.操作在指定模式下获取锁的次数。

system.profile.locks.acquireWaitCount

Number of times the operation had to wait for the acquireCount lock acquisitions because the locks were held in a conflicting mode. 由于锁定处于冲突模式,操作必须等待acquireCount锁定获取的次数。acquireWaitCount is less than or equal to acquireCount.acquireWaitCount小于或等于acquireCount

system.profile.locks.timeAcquiringMicros

Cumulative time in microseconds that the operation had to wait to acquire the locks.操作必须等待以获取锁的累计时间(以微秒为单位)。

timeAcquiringMicros divided by acquireWaitCount gives an approximate average wait time for the particular lock mode.timeAcquiringMicros除以acquireWaitCount得出特定锁定模式的近似平均等待时间。

system.profile.locks.deadlockCount

Number of times the operation encountered deadlocks while waiting for lock acquisitions.操作在等待获取锁时遇到死锁的次数。

For more information on lock modes, see What type of locking does MongoDB use?.有关锁定模式的更多信息,请参阅MongoDB使用什么类型的锁定?

system.profile.authorization

New in version 5.0.0. 5.0.0版新增。

The number of times the user cache is accessed for each operation. These metrics are only displayed when an operation has accessed the user cache at least once.每次操作访问用户缓存的次数。只有当操作访问用户缓存至少一次时,才会显示这些度量。

These metrics are only available when slow operation logging or database profiling is enabled.这些指标仅在启用慢速操作日志记录或数据库分析时可用。

system.profile.authorization is not included in db.currentOp() output.db.currentOp()输出中不包括system.profile.authorization

system.profile.authorization.startedUserCacheAcquisitionAttempts

The number of times the operation tried to access the user cache.操作尝试访问用户缓存的次数。

system.profile.authorization.completedUserCacheAcquisitionAttempts

The number of times the operation retrieved user data from the user cache.操作从用户缓存中检索用户数据的次数。

system.profile.authorization.userCacheWaitTimeMicros

The total time the operation spent waiting for user cache responses.操作等待用户缓存响应所花费的总时间。

system.profile.storage

The system.profile.storage information provides metrics on the storage engine data and wait time for the operation.system.profile.storage信息提供了有关存储引擎数据和操作等待时间的指标。

Specific storage metrics are returned only if the values are greater than zero.只有当值大于零时,才会返回特定的存储度量。

system.profile.storage.data.bytesRead

Number of bytes read by the operation from the disk to the cache.操作从磁盘读取到缓存的字节数。

Data read from disk into the cache includes everything needed to execute the query. 从磁盘读取到缓存中的数据包括执行查询所需的一切。 If the data is already in the cache, then the number of bytes read from disk could be 0.如果数据已经在缓存中,则从磁盘读取的字节数可能为0

The number of bytes read from disk includes more than the queried documents:从磁盘读取的字节数超过了查询到的文档数:

  • WiredTiger reads in units of pages and a page may contain one or several documents. WiredTiger以页面为单位进行读取,一个页面可能包含一个或多个文档。If a document is in a page, all documents in that page are read into the cache and included in the bytesRead value.如果文档在页面中,则该页面中的所有文档都将被读取到缓存中,并包含在bytesRead值中。
  • If the cache requires page management (such as eviction or rereads), the bytesRead value includes data read from disk in these operations.如果缓存需要页面管理(如逐出或重读),则bytesRead值包括在这些操作中从磁盘读取的数据。
  • If the index is not in the cache or the index in the cache is stale, WiredTiger reads several internal and leaf pages from disk to reconstruct the index in cache.如果索引不在缓存中,或者缓存中的索引已过时,WiredTiger会从磁盘读取几个内部页和叶页,以在缓存中重建索引。
system.profile.storage.data.timeReadingMicros

Time in microseconds that the operation had to spend to read from the disk.操作从磁盘读取所花费的时间(以微秒为单位)。

system.profile.storage.data.bytesWritten

Number of bytes written by the operation from the cache to the disk.操作从缓存写入磁盘的字节数。

WiredTiger typically doesn't require the query to write to disk. WiredTiger通常不需要查询就可以写入磁盘。Data modified by the query is written to an in-memory cache that WiredTiger flushes to disk as part an eviction or checkpoint operation. In such cases, bytesWritten shows as 0.查询修改的数据会写入内存中的缓存,WiredTiger会将该缓存刷新到磁盘,作为逐出或检查点操作的一部分。在这种情况下,bytesWritten显示为0

If the thread running the query requires forced page management (such as eviction), WiredTiger writes the page contents to disk. 如果运行查询的线程需要强制页面管理(如逐出),WiredTiger会将页面内容写入磁盘。This flush likely includes data unrelated to changes made by the query itself, which can cause bytesWritten to show a higher value than expected.此刷新可能包括与查询本身所做更改无关的数据,这可能会导致bytesWritten显示比预期更高的值。

system.profile.storage.data.timeWritingMicros

Time in microseconds that the operation had to spend to write to the disk.操作写入磁盘所花费的时间(以微秒为单位)。

system.profile.storage.timeWaitingMicros.cache

Time in microseconds that the operation had to wait for space in the cache.操作必须等待缓存中的空间的时间(以微秒为单位)。

system.profile.storage.timeWaitingMicros.schemaLock

Time in microseconds that the operation (if modifying the schema) had to wait to acquire a schema lock.操作(如果修改架构)必须等待以获取架构锁的时间(以微秒为单位)。

system.profile.storage.timeWaitingMicros.handleLock

Time in microseconds that the operation had to wait to acquire the a lock on the needed data handles.操作必须等待以获取所需数据句柄上的锁定的时间(以微秒为单位)。

system.profile.nreturned

The number of documents returned by the operation.操作返回的文档数。

system.profile.responseLength

The length in bytes of the operation's result document. 操作的结果文档的长度(以字节为单位)。A large responseLength can affect performance. To limit the size of the result document for a query operation, you can use any of the following:较大的responseLength会影响性能。若要限制查询操作的结果文档的大小,可以使用以下任意选项:

Note

When MongoDB writes query profile information to the log, the responseLength value is in a field named reslen.当MongoDB将查询配置文件信息写入日志时,responseLength值在一个名为reslen的字段中。

system.profile.cpuNanos

New in version 6.3. 6.3版新增。

The total CPU time spent by a query operation in nanoseconds. This field is only available on Linux systems.查询操作花费的总CPU时间(以纳秒为单位)。此字段仅在Linux系统上可用。

system.profile.protocol

The MongoDB Wire Protocol request message format.MongoDB Wire Protocol请求消息格式。

system.profile.millis

The time in milliseconds from the perspective of the mongod from the beginning of the operation to the end of the operation.mongod的角度来看,从操作开始到操作结束的时间(以毫秒为单位)。

planningTimeMicros

New in version 6.2. 6.2版新增。

The time, in milliseconds, that the find or aggregate command spent in query planning.findaggregate命令在查询计划中花费的时间(以毫秒为单位)。

system.profile.planSummary

A summary of the execution plan.执行计划的摘要。

system.profile.execStats

A document that contains the execution statistics of the query operation. For other operations, the value is an empty document.包含查询操作的执行统计信息的文档。对于其他操作,该值为空文档。

The system.profile.execStats presents the statistics as a tree; each node provides the statistics for the operation executed during that stage of the query operation.system.profile.execStats将统计信息显示为树;每个节点提供在查询操作的那个阶段执行的操作的统计信息。

Note

The following fields list for execStats is not meant to be exhaustive as the returned fields vary per stage.execStats的以下字段列表并不意味着详尽无遗,因为每个阶段返回的字段各不相同。

system.profile.execStats.stage

The descriptive name for the operation performed as part of the query execution; e.g.作为查询执行的一部分执行的操作的描述性名称;例如。

  • COLLSCAN for a collection scan用于集合扫描
  • IXSCAN for scanning index keys用于扫描索引键
  • FETCH for retrieving documents用于检索文档
system.profile.execStats.inputStages

An array that contains statistics for the operations that are the input stages of the current stage.一个数组,包含作为当前阶段的输入阶段的操作的统计信息。

system.profile.ts

The timestamp of the operation.操作的时间戳。

system.profile.client

The IP address or hostname of the client connection where the operation originates.发起操作的客户端连接的IP地址或主机名。

system.profile.appName

The identifier of the client application which ran the operation. 运行该操作的客户端应用程序的标识符。Use the appName connection string option to set a custom value for the appName field.使用appName连接字符串选项为appName字段设置自定义值。

system.profile.allUsers

An array of authenticated user information (user name and database) for the session. See also Users.会话的已验证用户信息(用户名和数据库)的数组。另请参见用户

system.profile.user

The authenticated user who ran the operation. If the operation was not run by an authenticated user, this field's value is an empty string.运行操作的经过身份验证的用户。如果操作不是由经过身份验证的用户运行的,则此字段的值为空字符串。

Example system.profile Documentsystem.profile文档示例

The following examples present sample documents found in the system.profile collection for operations on a standalone:以下示例提供了在system.profile集合中找到的用于独立操作的示例文档:

The following document in the system.profile collection shows metrics for a sample query operation on the test.report collection:system.profile集合中的以下文档显示了test.report集合上示例查询操作的度量:

{
"op" : "query",
"ns" : "test.report",
"command" : {
"find" : "report",
"filter" : { "a" : { "$lte" : 500 } },
"lsid" : {
"id" : UUID("5ccd5b81-b023-41f3-8959-bf99ed696ce9")
},
"$db" : "test"
},
"cursorid" : 33629063128,
"keysExamined" : 101,
"docsExamined" : 101,
"fromMultiPlanner" : true,
"numYield" : 2,
"nreturned" : 101,
"queryHash" : "811451DD",
"planCacheKey" : "759981BA",
"queryFramework" : "classic",
"locks" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(3),
"w" : NumberLong(3)
}
},
"Database" : {
"acquireCount" : { "r" : NumberLong(3) },
"acquireWaitCount" : { "r" : NumberLong(1) },
"timeAcquiringMicros" : { "r" : NumberLong(69130694) }
},
"Collection" : {
"acquireCount" : { "r" : NumberLong(3) }
}
},
"storage" : {
"data" : {
"bytesRead" : NumberLong(14736),
"timeReadingMicros" : NumberLong(17)
}
},
"responseLength" : 1305014,
"protocol" : "op_msg",
"millis" : 69132,
"planningTimeMicros" : 129,
"planSummary" : "IXSCAN { a: 1, _id: -1 }",
"execStats" : {
"stage" : "FETCH",
"nReturned" : 101,
"executionTimeMillisEstimate" : 0,
"works" : 101,
"advanced" : 101,
"needTime" : 0,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 2,
"isEOF" : 0,
"docsExamined" : 101,
"alreadyHasObj" : 0,
"inputStage" : {
...
}
},
"ts" : ISODate("2019-01-14T16:57:33.450Z"),
"client" : "127.0.0.1",
"appName" : "MongoDB Shell",
"allUsers" : [
{
"user" : "someuser",
"db" : "admin"
}
],
"user" : "someuser@admin"
}

The system.profile collection includes metrics for the getMore operation. In this example, getMore returns additional documents from the test.report collection.system.profile集合包括getMore操作的度量。在本例中,getMoretest.report集合返回其他文档。

{
"op" : "getmore",
"ns" : "test.report",
"command" : {
"getMore" : Long("33629063128"),
"collection" : "report",
"batchSize": 3,
"lsid" : {
"id": new UUID("3148c569-425c-4498-9168-5b7ee260bf27")
},
"$db" : "test"
},
originatingCommand: {
"find: "report",
"filter" : { "a" : { "$lte" : 500 } },
"lsid" : {
"id" : UUID("5ccd5b81-b023-41f3-8959-bf99ed696ce9")
},
"$db" : "test"
},
"cursorid" : Long("33629063128"),
"keysExamined" : 101,
"docsExamined" : 101,
"fromMultiPlanner" : true,
"numYield" : 2,
"nreturned" : 3,
"queryHash" : "811451DD",
"planCacheKey" : "759981BA",
"queryFramework": "classic"
"locks" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(3),
"w" : NumberLong(3)
}
},
"Database" : {
"acquireCount" : { "r" : NumberLong(3) },
"acquireWaitCount" : { "r" : NumberLong(1) },
"timeAcquiringMicros" : { "r" : NumberLong(69130694) }
},
"Collection" : {
"acquireCount" : { "r" : NumberLong(3) }
}
},
readConcern: {level: 'local', provenance: 'implicitDefault'},
"responseLength" : 1305014,
"protocol" : "op_msg",
"millis" : 69132,
"planSummary" : "IXSCAN { a: 1, _id: -1 }",
"execStats" : {
"stage" : "FETCH",
"filter" : { "a" : { "$lte" : 500 } },
"nReturned" : 101,
"executionTimeMillisEstimate" : 0,
"works" : 104,
"advanced" : 104,
"needTime" : 0,
"needYield" : 0,
"saveState" : 3,
"restoreState" : 2,
"isEOF" : 0,
"direction": 'forward',
"docsExamined" : 104
},
"ts" : ISODate("2019-01-14T16:57:33.450Z"),
"client" : "127.0.0.1",
"appName" : "MongoDB Shell",
"allUsers" : [
{
"user" : "someuser",
"db" : "admin"
}
],
"user" : "someuser@admin"
}

The profile entry for update (and delete) operation contains the entire update command.update(和delete)操作的配置文件条目包含整个更新命令。

The following document in the system.profile collection shows metrics for a sample update operation on the test.report collection:system.profile集合中的以下文档显示了test.report集合上示例更新操作的度量:

{
"op" : "update",
"ns" : "test.report",
"command" : {
"q" : { },
"u" : { "$rename" : { "a" : "b" } },
"multi" : true,
"upsert" : false
},
"keysExamined" : 0,
"docsExamined" : 25000,
"nMatched" : 25000,
"nModified" : 25000,
"keysInserted" : 25000,
"keysDeleted" : 25000000,
"numYield" : 6985,
"locks" : {
"Global" : {
"acquireCount" : { "r" : NumberLong(6986), "w" : NumberLong(13972) }
},
"Database" : {
"acquireCount" : { "w" : NumberLong(6986) },
"acquireWaitCount" : { "w" : NumberLong(1) },
"timeAcquiringMicros" : { "w" : NumberLong(60899375) }
},
"Collection" : {
"acquireCount" : { "w" : NumberLong(6986) }
},
"Mutex" : {
"acquireCount" : { "r" : NumberLong(25000) }
}
},
"storage" : {
"data" : {
"bytesRead" : NumberLong(126344060),
"bytesWritten" : NumberLong(281834762),
"timeReadingMicros" : NumberLong(94549),
"timeWritingMicros" : NumberLong(139361)
}
},
"millis" : 164687,
"planningTimeMicros" : 129,
"planSummary" : "COLLSCAN",
"execStats" : {
"stage" : "UPDATE",
"nReturned" : 0,
"executionTimeMillisEstimate" : 103771,
"works" : 25003,
"advanced" : 0,
"needTime" : 25002,
"needYield" : 0,
"saveState" : 6985,
"restoreState" : 6985,
"isEOF" : 1,
"nMatched" : 25000,
"nWouldModify" : 25000,
"wouldInsert" : false,
"inputStage" : {
"stage" : "COLLSCAN",
"nReturned" : 25000,
"executionTimeMillisEstimate" : 0,
"works" : 25002,
"advanced" : 25000,
"needTime" : 1,
"needYield" : 0,
"saveState" : 31985,
"restoreState" : 31985,
"isEOF" : 1,
"direction" : "forward",
"docsExamined" : 25000
}
},
"ts" : ISODate("2019-01-14T23:33:01.806Z"),
"client" : "127.0.0.1",
"appName" : "MongoDB Shell",
"allUsers" : [
{
"user" : "someuser",
"db" : "admin"
}
],
"user" : "someuser@admin"
}