Page 1 of 1

Updating custom columns on User collection using server side script

Posted: Wed Apr 09, 2014 3:35 pm
by Jacques van Niekerk

I have defined custom columns on the pre-defined collection Users. When I try to update the custom columns using a server side script, I receive the following error message: " { [Error: Collection 'Users' absent in database with id 'xxxxxxx'.] code: 'DBSU203' }. The database id works correctly in other calls to the Collections API. How do I update the custom columns in the user collection using server side code ?


Updating custom columns on User collection using server side script

Posted: Wed Apr 09, 2014 4:14 pm
by Kateryna Grynko

Hi Jacques,

Do you use such query? http://docs.appery.io/documentation/b...


Updating custom columns on User collection using server side script

Posted: Thu Apr 10, 2014 6:17 am
by Jacques van Niekerk

Here is the exact call I am making from the server side script: Collection.updateObject(dbid,"User", usr._id, customObject);

In this case customObject contains the data I wish to update. The error occurs because apparently the User collection cannot be found in the database with id dbid as mentioned above.
The question is - can one update the User collection using Collection.updateObject, and if not, how does one update custom fields in the User collection ?


Updating custom columns on User collection using server side script

Posted: Thu Apr 10, 2014 12:42 pm
by Maryna Brodina

Hello!
It's not possible to access predefined collections this way. Here is more information http://docs.appery.io/documentation/b...


Updating custom columns on User collection using server side script

Posted: Thu Apr 10, 2014 1:00 pm
by Jacques van Niekerk

OK - resolved. The following code works: DatabaseUser.update(dbid, usr._id, {"CustomColumn":customValue});
But please note that the documentation should state clearly that generic operations on Collections are NOT applicable to the pre-defined collections.


Updating custom columns on User collection using server side script

Posted: Thu Apr 10, 2014 1:07 pm
by Maryna Brodina

Thank you for update! We'll review docs!