Skip to content

Commit

Permalink
New index to enable distinct country searching AT SCALE #2559
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Mar 15, 2022
1 parent d096007 commit aff5275
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const indexes = [
{
name: 'locationCountry',
key: {
'location.country': -1,
},
collation: {
locale: 'en_US',
strength: 2,
},
},
{
name: 'travelHistoryCountry',
key: {
'travelHistory.travel.location.country': -1,
},
collation: {
locale: 'en_US',
strength: 2,
},
},
];
module.exports = {
async up(db, client) {
await db.command({
createIndexes: 'cases',
indexes: indexes,
});
},

async down(db, client) {
await db.command({
dropIndexes: 'cases',
index: ['locationCountry', 'travelHistoryCountry'],
});
},
};

0 comments on commit aff5275

Please sign in to comment.