DatabaseUser.remove(dbApiKey, objectId[, token])
Deletes a user from the database. On successful remove the method returns code 200 and empty body.
Instead of user session token you can provide the Master key to delete any user.
Parameters
The method has the following parameters:
Parameter | Description | Required |
---|---|---|
dbApiKey | String with database API key. | Yes. |
token | String with user token or Master key. | Yes. |
objectId | Unique identifier (ID) of the user that should be deleted. | Yes. |
Example
The following example signs up a new user and then immediately removes the user from the database.
var dbApiKey = "57928860e4b00ef864f3dc24"
var user = DatabaseUser.signUp(dbApiKey, {
"username": "jenny",
"password": "123"
});
DatabaseUser.remove (dbApiKey, user._id, user.sessionToken );