[PERFORMANCE] - Make email a low case string and amend/simplify searches in the Users collection #11382
Comments
|
@paulincai What is the proposed solution here? From what I have seen on the forums, using collation seemed to be favored, but the downside I see there is that you need to define a locale which might create some interesting edge cases. I'm all for improving the search script, but please bear in mind that the local-part of the e-mail can be case sensitive as per RFC5321. |
|
@StorytellerCZ
In the example below I am logging in to my Yahoo with an existing address and I am being matched to a lower case address. In the example below, which is my recommendation for our subject in discussion here, I trying to create a mixed case address and I am being provided with a lower case address. We could let the user type in a mixed case address and, like Yahoo, convert to lower case before saving to DB. This could be done in two ways:
|
|
Domain is always lowercase, the problem is with the local-part: That major providers automatically lowercase them is all nice and dandy, but this needs to work for everyone. I'm for optimizing and improving the search, but I'm against disregarding the standard which will only result into a bug report down the line that will demand that Meteor Accounts follow RFC5321. |
|
ok, that is understandable. In this case perhaps we can leave it to the developer/app owner to decide on how she wants to handle emails. Meteor stays compliant (base tech level), I fine tune my performance (app owner tech level / overlay) perhaps via Accounts.config({ useLowerCaseEmails: true }) ....with a better key naming :) which calls a different search function in the Accounts. As far as improving the case sensitive search is concerned, I am completely clueless whether the actual setup with |
|
@paulincai – Totally agree that leaving up to the developer makes sense here. We run a B2B SaaS service that has thousands of users and we enforce lowercase emails throughout the system. No one has ever complained and we haven't had any issues over our several years of operation. |
|
Hi, I am new to open source. I created a Pull Request which implements the above-proposed solution. Thanks |
|
@ritwik1233 Thanks a lot! We will take a look at it and if everything checks out (which I think it does) we will get it out by the next Meteor release. |
|
Thank you so much.
This was a great learning experience for me.
Thanks and Regards
Ritwik Sinha
…On Tue, May 11, 2021, 9:09 PM Jan Dvorak ***@***.***> wrote:
@ritwik1233 <https://github.com/ritwik1233> Thanks a lot! We will take a
look at it and if everything checks out (which I think it does) we will get
it out by the next Meteor release.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11382 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD7R65QL3BF5BPZU7KUZT5DTNFFTHANCNFSM42WLCPFA>
.
|
|
Please test the proposed PR #11419 and let us know what impact it had so that we can move forward with releasing or improving it. |
|
@paulincai did you get a chance to test the PR? |
|
Hi @StorytellerCZ to be frank I didn't even know this was expected of me. Following a conversation in the Forum I took the liberty to speak on behalf of those participants and raised the ticket :). Anyway, now that you appointed me on this one, let's look at it... I used the files you provided here https://gist.github.com/zodern/4ad546b9ddc2cf780fed476c85c1f053 and modified them to use in a Meteor project. A small repo here based on create app --react: https://github.com/paulincai/test_users/tree/main/server My results look like this (observe Searching, found and Spent. Unlike the initial files which traverse the entire DB (having a '+ x' at the end of the searched email), I am actually searching for the right addresses and find them): When searching for the exact address, like would be the case when users can only save addresses in small caps, the time is constantly 1-2ms. |




I am really sorry if this was discussed already in the form of an issue. I was supposed to raise this one a couple of months back and got disconnected from business for a while.
The issue is explained at this link:
https://forums.meteor.com/t/slow-mongo-query-on-createuser/54879
"
My app has about 400K users, and this query can take up to 6000ms (especially when the email address starts with a common first name).
"
The text was updated successfully, but these errors were encountered: