是否有 Azure Cosmos db/Azure SQL 数据库功能来订阅 Firestore 中的数据更改?

时间:2021-03-26 13:09:11

标签: azure google-cloud-firestore azure-sql-database azure-cosmosdb

例如在 firestore 中获取实时更新

db.collection("cities").where("state", "==", "CA")
    .onSnapshot((querySnapshot) => {
        var cities = [];
        querySnapshot.forEach((doc) => {
            cities.push(doc.data().name);
        });
        console.log("Current cities in CA: ", cities.join(", "));
    });

我如何使用 Azure cosmos db 或 Azure SQL 数据库来做到这一点,无论哪个是可能的

1 个答案:

答案 0 :(得分:1)

您正在寻找的是 Azure Cosmos DB 更改源 - https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed

来自上面的链接:

<块引用>

Azure Cosmos DB 中的更改源是对更改的持久记录 容器按照它们出现的顺序。 Azure Cosmos 中的更改源支持 DB 通过侦听 Azure Cosmos 容器的任何更改来工作。它 然后输出在 它们被修改的顺序。持久的更改可以是 异步和增量处理,输出可以 分布在一个或多个消费者之间以进行并行处理。

相关问题