插入
摘要
描述
字段 | 类型 | 描述 |
---|---|---|
_id | 文档 | |
clusterTime | 时间戳 |
由于 oplog 大小限制,多文档事务可能会创建多个 oplog 条目。在事务中,给定 oplog 条目中安排更改流事件具有相同的 具有相同 要标识单个事务的事件,您可以在更改流事件文档中使用 已更改版本8.0. |
collectionUUID | UUID | UUID 识别发生更改的集合。 新版本6.0. |
documentKey | 文档 | 包含由CRUD操作创建或修改的文档的 对于分片集合,此字段还会显示文档的完整分片键。如果 |
fullDocument | 文档 | 由操作创建的文档。 已更改版本6.0. 从MongoDB 6.0开始,如果您使用 |
lsid | 文档 | 与事务关联的会话标识符。 仅当操作是多文档事务的一部分时才存在。 |
ns | 文档 | 受事件影响的数据命名空间(数据库和或集合)。 |
ns.coll | 字符串 | 事件发生的集合名称。 |
ns.db | 字符串 | 事件发生的数据库名称。 |
operationType | 字符串 | 更改通知报告的操作类型。 对于这些更改事件,返回值为 |
txnNumber | NumberLong | |
wallTime | 数据库操作的服务器日期和时间。 新版本6.0. |
示例
以下示例说明了insert
事件。
{ "_id": { <Resume Token> }, "operationType": "insert", "clusterTime": <Timestamp>, "wallTime": <ISODate>, "ns": { "db": "engineering", "coll": "users" }, "documentKey": { "userName": "alice123", "_id": ObjectId("599af247bb69cd89961c986d") }, "fullDocument": { "_id": ObjectId("599af247bb69cd89961c986d"), "userName": "alice123", "name": "Alice" } }
documentKey
字段包含_id
和userName
字段。这表明engineering.users
集合是分片的,分片键为userName
和_id
。
fullDocument
文档表示插入时的文档版本。