Start a new topic
Answered

Is nickname already used

Hello,

first, my english is not so good(I'm from Germany)! -.- I hope you can understand what I mean.


I will build an app with a nickname. But I don't know how can I check whether is this nickname already used by an other user. The normal username field can't I use, because I need it for other things. And I have the same problem with another field.


Yours sincerly,

Alex


Best Answer
Alex,

You can add a “nickname” field to the User collection.

In the User.PreSave() hook - which is called before saving a user to the collection - you can check whether the nickname already exists. If it already exists, you can send an error back. (In the PreSave() hook, you will also have to differentiate between the case of adding a new user vs saving an existing user)

Here is a link for more details about business-logic : http://devcenter.kinvey.com/android/guides/business-logic


Thanks,
Pranav
Kinvey Support

 


Hello Alex,


Your English is fine so yes, we can understand your writing. However, I don't quite understand what you are asking about. 


What do you mean that you want to build an app with a nickname?


The Users collection is a unique list that is associated with the app that you create. If you add a "nickname" field to the Users collection, if someone else with another app in the Kinvey backend is using that nickname, it will NOT conflict with your nickname. 


So unless I am completely misunderstanding what you are asking, then you should be OK.


If I haven't understood your question correctly, can you please provide additional details about the use case you would like to implement?


Regards,


Billy Gee

Kinvey, Inc.

Answer
Alex,

You can add a “nickname” field to the User collection.

In the User.PreSave() hook - which is called before saving a user to the collection - you can check whether the nickname already exists. If it already exists, you can send an error back. (In the PreSave() hook, you will also have to differentiate between the case of adding a new user vs saving an existing user)

Here is a link for more details about business-logic : http://devcenter.kinvey.com/android/guides/business-logic


Thanks,
Pranav
Kinvey Support

 

Login or Signup to post a comment