It seems like mongoose (5.6.11) is changing my value in a query. Is this normal? Is there a way to keep the string case the same?
console.log('>>',req.body.visitor)
Visitor.findOne({ email: req.body.visitor.email }).then((visitor)=>{
....
server console/log:
>> {
email: 'Maida_VonRueden@hotmail.com',//this is a fake email generated with faker
enteredValidationCode: '969621'
}
Mongoose: visitors.findOne({ email: 'maida_vonrueden@hotmail.com' }, { projection: {} })
// ^ Why does the email change here?
Do I have to use regex to query case insensitive (Visitor.findOne({email: {$regex: new RegExp(req.body.visitor.email, 'i')}}))?