DatabaseUser.update(dbId, objectId, userJSON[,token])
Updates information about the user in the database.
Parameters
This method has the following parameters:
Argument | Description |
---|---|
dbId | String with database ID. |
token | String with user token (optional). |
objectId | Unique identifier of the user that should be updated. |
userJSON | User 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);