本文整理汇总了C#中MongoDatabase.GetCollectionNames方法的典型用法代码示例。如果您正苦于以下问题:C# MongoDatabase.GetCollectionNames方法的具体用法?C# MongoDatabase.GetCollectionNames怎么用?C# MongoDatabase.GetCollectionNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDatabase
的用法示例。
在下文中一共展示了MongoDatabase.GetCollectionNames方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogViewModel
public LogViewModel()
{
mongoServer = MongoServer.Create("mongodb://localhost");
mongodb = mongoServer.GetDatabase("log");
List<string> logInstances = (from instanceName in mongodb.GetCollectionNames()
where !instanceName.StartsWith("system.")
select instanceName).ToList();
LogInstances = CollectionViewSource.GetDefaultView(logInstances);
if (logInstances.Count > 0)
{
LogCurrentInstance = logInstances.First();
List<LogViewModelEntry> enties = new List<LogViewModelEntry>();// GetLogEntries(page);
LogEntries = CollectionViewSource.GetDefaultView(enties);
}
}
示例2: BuildListBox
private ListBox BuildListBox(MongoDatabase database)
{
ListBox lb = new ListBox();
foreach (String name in database.GetCollectionNames())
if (!name.StartsWith("system"))
lb.Items.Add(name);
lb.SelectionMode = SelectionMode.One;
lb.SelectedValueChanged += OnListBoxSelectedValueChanged;
return lb;
}
示例3: GetCollectionNames
private static IEnumerable<string> GetCollectionNames(MongoDatabase database)
{
return database.GetCollectionNames().Where(s => !s.StartsWith("system."));
}
示例4: CollectionsInfo
public CollectionsInfo(MongoDatabase mdd)
{
md = mdd;
lmcName.AddRange(md.GetCollectionNames());
MongoUser[] mus= md.FindAllUsers();
}
示例5: DropAndCreateCollections
private static void DropAndCreateCollections(MongoDatabase db, string[] collections)
{
string[] names = Enumerable.ToArray<string>(db.GetCollectionNames());
foreach (string name in names)
{
if (collections.Contains(name))
{
db.DropCollection(name);
}
}
foreach (string collection in collections)
{
db.CreateCollection(collection);
}
}