从集合属性获取集合名称

问题描述 投票:0回答:1

我是 MongoDB 新手,我想问你们一个问题:
但是可以通过 mongo 查询语言从集合的属性中获取一个集合的名称吗?

我看到了 mongo 文档,但我没有找到任何东西。

mongodb mongodb-query
1个回答
0
投票

在C#中可以这样使用

//create an instance of a MongoDB client
List<string> collectionNames= _dbClient
                           .GetDatabase("{your-db-name}")
                           .ListCollectionNames()
                           .ToListAsync();
© www.soinside.com 2019 - 2024. All rights reserved.