Viktor
Posts: 0
Joined: Mon Jun 01, 2015 7:48 am

Query problem with upper and lower case.

I've asked a similar question before without success. I have a user registration service. When login the username is also mapped to a localstorage, which later database rows are connected to. So when I later query rows under that username everything is good. As long as my phone don't make the first letter of my username Uppercase (when login) which then results in nothing found when doing a query (searching rows with that specific username). How do I solve this problem? Please don't direct me to some long documentation as I've read through many of them without finding my answer. Would really appreciate the help! Thanks! A solution would be to make the login case sensitive but I have no idea how to do that either. Again thanks for replies.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Query problem with upper and lower case.

Hello Viktor,

Please check if user exists via Query service: https://devcenter.appery.io/documenta...
And run login service on success event

Viktor
Posts: 0
Joined: Mon Jun 01, 2015 7:48 am

Query problem with upper and lower case.

To do a query service un Users, I need session token which is provided after login? so how do I do this before?
Secondly, after following the tutorial you sent me all users are listed when a test is done. When I place "where" under query string instead of header "username":"userexample" then it says Incorrect query.
By checking if user exists I assume you mean me to use the query constraint $exists which should be where - {"username": {"$exists":true}}' ? which of course doesn't work either. Im sure Im doing some obvious stupid mistake here but I really appreciate the help! And would be glad if you could instruct me further? I am quiet frustrated now that I can't get this which seems to be simple thing to work!

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Query problem with upper and lower case.

1) so how do I do this before?
You need create special "admin" user with predefined login/password, which will login to your app automatically before "real" user login.

2) Please send us screenshot of the test tab with this error.

Viktor
Posts: 0
Joined: Mon Jun 01, 2015 7:48 am

Query problem with upper and lower case.

Thanks! Really want to get this working! :)
Doesn't seem to matter what I write in the where parameter, same result every time. Just lists all users. Image

Here are print screens of the check if user exists part: Image Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query problem with upper and lower case.

Hi Viktor,

You need to use $regex and "i" modifier there.

Here is a code example for you:

pre

var whereObject = {username: {"$regex": value, "$options":"i"}};

return JSON.stringify(whereObject);

/pre

Regards.

Viktor
Posts: 0
Joined: Mon Jun 01, 2015 7:48 am

Query problem with upper and lower case.

Thanks! Sorry tried but not sure what to do with this code. Could you explain a bit further? Inserted it at JS where but didn't change anything.. What should be the response of the query service and what should I do with it?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query problem with upper and lower case.

Hi Viktor,

"Where" request parameter - is a filter. So this parameter filter items with filter criteria.

In your response you will receive items that will fit to your filter.

So with this where clause you should receive items which have in "username" field value that you pass to this where request parameter via link(in mapping).

Please follow this tutorial to understand how it works: https://devcenter.appery.io/tutorials...

Regards.

Return to “Issues”