update

DatabaseUser.update(dbId, objectId, userJSON[,token])

Updates information about the user in the database.

Parameters

This method has the following parameters:

ArgumentDescription
dbIdString with database ID.
tokenString with user token (optional).
objectIdUnique identifier of the user that should be updated.
userJSONUser JSON object.

Response

This method has the following response object:

{
   "username":<username>,
   "_createdAt":<datetime>,
   "_updatedAt":<datetime>,
   "_id":<user_id>
}
Example

Updating a user name and password.

var dbId = "52776916a044652b54f1f976";
var username = "testUser10";
var password = "testUser10";
 
var id = DatabaseUser.signUp(dbId, {
  "username": username,
  "password": password
})._id;

var token = DatabaseUser.login(dbId, username, password).sessionToken;

var updated = DatabaseUser.update(dbId, id, {
    "username": "testUserNew",
    "password": "testUserNew"
}, token);