new tournament database index for createdBy+startsAt+status

for #9850

else the API endpoint could be scanning thousands of records
pull/9850/head
Thibault Duplessis 2021-09-20 18:58:41 +02:00
parent 31ba5d3a08
commit 07e2b28a6c
1 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1,6 @@
db.tournament2.update({ createdBy: 'lichess' }, { $unset: { createdBy: 1 } }, { multi: 1 });
db.tournament2.dropIndex('createdBy_1_startsAt_-1');
db.tournament2.createIndex(
{ createdBy: 1, startsAt: -1, status: 1 },
{ partialFilterExpression: { createdBy: { $exists: true } } }
);