public WikiPageService(MongoClientService mongoClientService) { _collection = mongoClientService.MongoClient .GetDatabase("wiki") .GetCollection <WikiPage>("pages"); _collection.Indexes.CreateOne( new CreateIndexModel <WikiPage>( Builders <WikiPage> .IndexKeys.Ascending(model => model.Slug), new CreateIndexOptions() { Unique = true })); }
public WikiPageRevisionService(MongoClientService mongoClientService) { _collection = mongoClientService.MongoClient .GetDatabase("wiki") .GetCollection <WikiPageRevision>("revisions"); _collection.Indexes.CreateOne( new CreateIndexModel <WikiPageRevision>( Builders <WikiPageRevision> .IndexKeys .Ascending(model => model.PageId) .Ascending(model => model.RevisionNumber), new CreateIndexOptions() { Unique = true })); }