【问题标题】:How to get the list of all the databases in an Azure DocumentDB account?如何获取 Azure DocumentDB 帐户中所有数据库的列表?
【发布时间】:2015-11-17 14:41:06
【问题描述】:

在 Microsoft Azure DocumentDb 中,如何检索所有数据库的列表?不是特定数据库中的文档,而是特定帐户的所有数据库。最好使用标准的DocumentClient 类。

【问题讨论】:

    标签: c# azure azure-cosmosdb


    【解决方案1】:

    你可以像下面这样:

                using (var documentClient = new DocumentClient(new Uri("<endpoint>"), "<accountkey>"))
                {
                    var listDatabasesOperationResult = await documentClient.ReadDatabaseFeedAsync();
                    foreach (var item in listDatabasesOperationResult)
                    {
                        Console.WriteLine(item.Id);
                    }
                }
    

    【讨论】:

    • An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll but was not handled in user code -- 我想知道为什么?
    • @jawanam 您能否提供此异常的完整堆栈跟踪。我以前从未在此 SDK 中看到过 FileNotFoundException。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-05
    • 2019-11-18
    • 2014-05-02
    • 2018-04-16
    • 2022-01-20
    • 2021-12-05
    • 2023-03-24
    相关资源
    最近更新 更多