Skip to content

Commit

Permalink
Add the correct collation to the country names search query #2559
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Apr 19, 2022
1 parent ab00cf4 commit 1331622
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions verification/curator-service/api/src/controllers/geocode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,18 @@ export default class GeocodeProxy {
*/
countryNames = async (req: Request, res: Response): Promise<void> => {
const database = db();
const locationCountryCodes = await database.collection('cases').distinct('location.country');
const travelHistoryCodes = await database.collection('cases').distinct('travelHistory.travel.location.country');
const locationCountryCodes = await database.collection('cases').distinct('location.country', {}, {
collation: {
locale: 'en_US',
strength: 2,
}
});
const travelHistoryCodes = await database.collection('cases').distinct('travelHistory.travel.location.country', {}, {
collation: {
locale: 'en_US',
strength: 2,
}
});
const allCodes = new Set<string>(locationCountryCodes.concat(travelHistoryCodes));
const namesMap: {
[key: string]: string[] | undefined
Expand Down

0 comments on commit 1331622

Please sign in to comment.