Page 1 of 1
Query problem with upper and lower case.
Posted: Sun Jun 07, 2015 12:14 pm
by Viktor
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.
Query problem with upper and lower case.
Posted: Mon Jun 08, 2015 5:42 am
by Serhii Kulibaba
Hello Viktor,
Please check if user exists via Query service: https://devcenter.appery.io/documenta...
And run login service on success event
Query problem with upper and lower case.
Posted: Mon Jun 08, 2015 1:32 pm
by Viktor
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!
Query problem with upper and lower case.
Posted: Tue Jun 09, 2015 10:19 am
by Serhii Kulibaba
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.
Query problem with upper and lower case.
Posted: Tue Jun 09, 2015 11:29 am
by Viktor
Query problem with upper and lower case.
Posted: Thu Jun 11, 2015 3:36 am
by Yurii Orishchuk
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.
Query problem with upper and lower case.
Posted: Thu Jun 11, 2015 6:59 am
by Viktor
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?
Query problem with upper and lower case.
Posted: Fri Jun 12, 2015 1:52 am
by Yurii Orishchuk
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.