Skip to content

Commit

Permalink
added new migration with additional user index for email
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskar Kocjan authored and abhidg committed Jul 13, 2022
1 parent f84fcf3 commit a9b141e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ const indexes = [
key: {
googleID: 1,
},
collation: {
locale: 'en_US',
strength: 2,
},
},
];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const indexes = [
{
name: 'email',
key: {
email: 1,
},
collation: {
locale: 'en_US',
strength: 2,
},
},
];

module.exports = {
async up(db, client) {
await db.command({
createIndexes: 'users',
indexes: indexes,
});
},

async down(db, client) {
await db.command({
dropIndexes: 'users',
index: ['email'],
});
},
};
4 changes: 2 additions & 2 deletions verification/curator-service/api/src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ export class AuthController {
async (req, email, password, done) => {
try {
const userPromise = await users().find({ email })
.collation({ locale: 'en', strength: 2 })
.collation({ locale: 'en_US', strength: 2 })
.toArray();

const user = userPromise[0];
Expand Down Expand Up @@ -713,7 +713,7 @@ export class AuthController {
async (email, password, done) => {
try {
const userPromise = await users().find({ email })
.collation({ locale: 'en', strength: 2 })
.collation({ locale: 'en_US', strength: 2 })
.toArray();

const user = userPromise[0] as IUser;
Expand Down

0 comments on commit a9b141e

Please sign in to comment.