Scale unique answer tracking
This commit is contained in:
@@ -8,13 +8,9 @@ public class QuestionStore
|
||||
{
|
||||
private readonly IMongoCollection<Question> _col;
|
||||
|
||||
public QuestionStore(IConfiguration cfg)
|
||||
public QuestionStore(MongoDatabaseProvider mongo)
|
||||
{
|
||||
var cs = cfg["MongoDB:ConnectionString"] ?? "mongodb://127.0.0.1:27017";
|
||||
var dbName = cfg["MongoDB:DatabaseName"] ?? "GameDb";
|
||||
var client = new MongoClient(cs);
|
||||
var db = client.GetDatabase(dbName);
|
||||
_col = db.GetCollection<Question>("Questions");
|
||||
_col = mongo.Database.GetCollection<Question>("Questions");
|
||||
|
||||
var externalIdIndex = Builders<Question>.IndexKeys.Ascending(q => q.ExternalId);
|
||||
_col.Indexes.CreateOne(new CreateIndexModel<Question>(externalIdIndex, new CreateIndexOptions { Unique = true }));
|
||||
|
||||
Reference in New Issue
Block a user