正确答案: 创建一个 Azure Cosmos DB for MongoDB 帐户,并更新应用程序的连接字符串以指向 Cosmos DB for MongoDB 端点;继续使用 MongoDB 驱动程序。, 使用 Azure Database Migration Service (DMS) 执行从 MongoDB Atlas 到 Azure Cosmos DB for MongoDB 的在线迁移。.
为什么这是答案
创建 Azure Cosmos DB for MongoDB 帐户并更新连接字符串是正确的,因为 Azure Cosmos DB 的 MongoDB API 兼容 MongoDB 驱动程序,允许您在不更改应用程序代码的情况下迁移。这最大程度地减少了停机时间,因为您只需更改连接字符串。使用 Azure Database Migration Service (DMS) 执行在线迁移也是正确的,因为它支持从 MongoDB 到 Azure Cosmos DB for MongoDB 的连续数据同步,确保在迁移期间最小化停机时间。重写应用程序以使用 Azure Cosmos DB SQL API SDK 是不必要的,因为 MongoDB API 提供了兼容性。将数据迁移到 Azure Cosmos DB SQL API 帐户并继续使用 MongoDB 驱动程序是错误的,因为 MongoDB 驱动程序与 SQL API 不兼容。