【发布时间】:2020-06-24 16:36:47
【问题描述】:
通过代码创建新集合时,添加新索引的调用失败:
private static void CreateCollection<T>(string collectionName, CreateIndexModel<T> index)
{
var database = GetMongoDatabase();
database.CreateCollection(collectionName);
var collection = database.GetCollection<T>(collectionName);
collection.Indexes.CreateOne(index); // Message=Command createIndexes failed
}
【问题讨论】:
标签: c# mongodb mongodb.driver