Get user whose data equals x

0 votes
Hi All

I save additional data along with user. Then, for example I want to get user whose "Coin" equals 20. How can I do this? And How many api calls needed for this?

Thanks

Gökhan
asked Feb 29, 2016 in Unity by gokhan (20 points)

1 Answer

0 votes

Hi Gokhan,

You can create a query to segment list of users from storage service in which one API call will be count  for 100 records. For example: If you have 900 records who have 20 coins, then your API call will be 9. Please have a look at this link for the code snippet and let us know if it helps.   

regards,

Himanshu Sharma

answered Mar 1, 2016 by hs00105 (2,005 points)
Hi Himanshu
I know the api "findDocumentsByQuery". But it return storage object. I need "User" object. Thats why I am asking. I need the "User" object whose data equals x.
Hi Gokhan,

In that case, you can use this(http://api.shephertz.com/app42-docs/user-management-service/#fetch-additional-data-of-user) function and let me know if it helps.

regards.
Himanshu Sharma
Bro
I dont know the userName but you send me api which takes userName as Input:) Lets make it more clear. I save facebook access token as additional data to achieve that user can login with facebook as well. So when player clicks "Login with Faceebook" button, I will query so that give me User object whose "FBToken" equals blabla. Do you understand? So, I dont know userName, I know value of key stored in storage service.
Hi Gokhan,

Thanks for your detail input. In order to resolve this, first you can fetch the list of usernames from Storage service based on your customized query(http://api.shephertz.com/app42-docs/nosql-storage-service/#find-document-by-query-paging). Once you have the list of users along with you, you can fetch user object from User service using GetUser (http://api.shephertz.com/app42-docs/user-management-service/#fetch-additional-data-of-user) function. Let me know if it helps.

Also, if you have any other question, we can discuss on the call.

Regards.
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...