最新版本模式是创建和更新操作中对项所做更改的永久记录。 获取容器中每个项的最新版本。 例如,如果在读取更改源之前创建了某个项并对其进行了更新,则更改源中仅显示更新的版本。 删除操作不会作为更改进行记录,并且删除某个项后,它在数据流中不再可用。 最新版本更改源模式默认处于启用状态,并与所有 Azure Cosmos DB 帐户(API for Table 和 API for PostgreSQL 除外)兼容。 此模式以前是使用更改源的默认方式。
所有版本和删除更改源模式(预览版)
所有版本和删除模式(预览版)是创建、更新和删除操作中对项做出的所有更改的永久记录。 可以按对项做出每个更改的顺序获取对应更改的记录,包括在读取更改源期间对项进行的中途的更改。 例如,如果在读取更改源之前创建了某个项并对其进行了更新,则更改源中会显示创建和更新版本。 若要在所有版本和删除模式下读取更改源中的内容,必须为 Azure Cosmos DB 帐户配置连续备份。 启用连续备份会创建所有版本并删除更改源。 使用此更改源模式时,只能读取在连续备份期间发生的更改。 此模式仅与 Azure Cosmos DB for NoSQL 帐户兼容。 详细了解如何注册预览版。
{
"current": {
<The current version of the item that changed. All the properties of your item will appear here.>
},
"metadata": {
"operationType": "create",
"lsn": <A number that represents the batch ID. Many items can have the same lsn.>,
"crts": <A number that represents the Conflict Resolved Timestamp. It has the same format as _ts.>
}
}
替换操作
{
"current": {
<The current version of the item that changed. All the properties of your item will appear here.>
},
"metadata": {
"operationType": "replace",
"lsn": <A number that represents the batch ID. Many items can have the same lsn.>,
"crts": <A number that represents the Conflict Resolved Timestamp. It has the same format as _ts.>,
"previousImageLSN" : <A number that represents the batch ID of the change prior to this one.>,
}
}
删除操作
{
"metadata": {
"operationType": "delete",
"lsn": <A number that represents the batch ID. Many items can have the same lsn.>,
"crts": <A number that represents the Conflict Resolved Timestamp. It has the same format as _ts.>,
"previousImageLSN" : <A number that represents the batch ID of the change prior to this one.>,
"timeToLiveExpired" : <'true' if it was deleted due to a TTL expiration.>,
"id": "<Id of the deleted item.>",
"partitionKey": {
"<Partition key property name>": "<Partition key property value>"
}
}
}
限制
支持 Azure Cosmos DB for NoSQL 帐户。 不支持其他 Azure Cosmos DB 帐户类型。