public async Task CreateCollenction() { //创建文档并且固定文档的大小 当超出大小时,移除过时的文档 mongoRepository.DataBase().CreateCollection("test22" + new Random().Next(1, 10000), new CreateCollectionOptions { Capped = true, MaxDocuments = 10, MaxSize = 1000 }); await mongoRepository.DataBase().CreateCollectionAsync("test111" + new Random().Next(1, 10000)); }