在不使用 "createIfNotExists" 的情况下创建 Cosmos DB 连接

Create a CosmosDB connection whitout using the "createIfNotExists"

我正在使用 nodeJS 并尝试创建与 CosmosDB 的连接,我想知道我是否可以在不使用“createIfNotExists”的情况下做到这一点

const getCosmosClient = async (): Promise<Database> => {
  const { database } = await cosmosClient.databases.createIfNotExists({ id: DATABASES.databaseId });

  return database;
};

扫了一眼documentation,可以用cosmosClient.database(id)。它应该 return 一个 Database 而不是 Promise<DatabaseResponse>.