Start a new topic
Answered

Account creation with additional fields

Hi,


I need to create a user and add additional fields to it.


The documentation tells us to create the user and then update it.


Is there a way to create the user with additional fields using only one call ?


Thanks.


Best Answer

I believe you can do that by creating a User object and then putting the required extra info and then calling create() on it like so:


   

final AsyncUser user = getKinveyClient().user();
user.put("extra_info_1", "stuff");
 
user.create(username.trim().toLowerCase(), password.trim(), kinveyCallback);

   


Fabreax,


Where mongo is schemaless, users are just another "document" in a sense.  You can add and remove fields as you see fit.  


Thanks,

Yes, but the Kinvey "create" method contains only 2 parameters : username and password.

It could be interesting to add this method : create(login, password, morefieldsHashMap)

Answer

I believe you can do that by creating a User object and then putting the required extra info and then calling create() on it like so:


   

final AsyncUser user = getKinveyClient().user();
user.put("extra_info_1", "stuff");
 
user.create(username.trim().toLowerCase(), password.trim(), kinveyCallback);

   


1 person likes this

Thanks ! It works ;)

I love when this happens.  Thanks Gary :)

Login or Signup to post a comment