createIndexes Event
On this page
Summary总结
createIndexesNew in version 6.0.
A当在集合上创建索引并且更改流的createIndexesevent occurs when an index is created on the collection and the change stream has the showExpandedEvents option set totrue.showExpandedEvents选项设置为true时,将发生createIndexes事件。
Description描述
_id | Document | resumeToken for the resumeAfter parameter when resuming a change stream. resumeAfter参数的resumeToken。_id object has the following form:_id对象具有以下形式:
{
|
clusterTime | Timestamp | clusterTime value: the time when the transaction was committed.clusterTime值:事务提交的时间。clusterTime may not all relate to the same transaction. clusterTime的事件可能并不都与同一事务相关。To identify events for a single transaction, you can use the combination of lsid and txnNumber in the change stream event document. lsid和txnNumber的组合。New in version 4.0. |
collectionUUID | UUID | UUID New in version 6.0. |
lsid | document | New in version 4.0. |
ns | document | |
ns.db | string | |
ns.coll | string | |
operationDescription | document | New in version 6.0. |
operationDescription.indexes | array | New in version 6.0. |
operationType | string | createIndexes for these change events. createIndexes值。 |
txnNumber | NumberLong | lsid一起,是一个有助于唯一识别事务的数字。New in version 4.0. |
wallTime | ISODate | wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event. wallTime与clusterTime的不同之处在于,clusterTime是从与数据库操作事件关联的oplog条目中获取的时间戳。New in version 6.0. |
Example实例
The following example shows a 以下示例显示了createIndexes event:createIndexes事件:
{
"_id": { <ResumeToken> },
"operationType": "createIndexes",
"clusterTime": Timestamp({ t: 1651257835, i: 1 }),
"collectionUUID": UUID("06bced37-7cc8-4267-96aa-a58a422153d8"),
"wallTime": ISODate("2022-04-29T18:43:55.160Z"),
"ns": {
"db": "test",
"coll": "authors"
},
"operationDescription": {
"indexes": [
{ "v": 2, "key": { "name": 1 }, "name": "name_1" }
]
}
}