You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be cool to have a sugar-operator called $begins that is internally implemented as an AND of $gte a $lt to find any value starting with a desired pattern.
Desired Behaviour
The usage il something like this: let's suppose we want to find all people with surname starting with "Branca" either for autocompletition purpose or just because the user may have a second surname. Actually one could only do:
"Surname": {
$eq: "Branca"
}
That wouldn't find either "Brancatelli" nor "Branca SecondSurname"
The only solution would be to:
"Surname": {
$regex: "Branca"
}
That is unindexed.
Possible Solution
As in summary a solution could be to implement a sugar-operator called $begins that internally gets mapped to an AND-combination of $gte and $lt with an upper character as an upper bound. So, calling:
Summary
It would be cool to have a sugar-operator called $begins that is internally implemented as an AND of $gte a $lt to find any value starting with a desired pattern.
Desired Behaviour
The usage il something like this: let's suppose we want to find all people with surname starting with "Branca" either for autocompletition purpose or just because the user may have a second surname. Actually one could only do:
That wouldn't find either "Brancatelli" nor "Branca SecondSurname"
The only solution would be to:
That is unindexed.
Possible Solution
As in summary a solution could be to implement a sugar-operator called $begins that internally gets mapped to an AND-combination of $gte and $lt with an upper character as an upper bound. So, calling:
would be translated in
That would use the index as expected.
The text was updated successfully, but these errors were encountered: