Members
LoggedOut
- the user is logged outLoggedIn
- the user is logged inRemoved
- the user has been removed
Gets this user's access token. This is the user's credential for accessing the MongoDB Realm Cloud and should be treated as sensitive data.
Type:
string
Gets this user's associated custom data. This is application-specific data provided by the server.
Type:
object
Gets the device id. null
if no device id.
Type:
string
Convenience wrapper around callFunction(name, [args])
Examples::
// These are all equivalent:
await user.callFunction("do_thing", [a1, a2, a3]);
await user.functions.do_thing(a1, a2, a3);
await user.functions["do_thing"](a1, a2, a3);
// It it legal to store the functions as first-class values:
const do_thing = user.functions.do_thing;
await do_thing(a1);
await do_thing(a2);
Gets the id of this user on Atlas App Services. The id is a guaranteed to be unique among all users on Atlas App Services.
Type:
string
Gets an array of identities for this user.
Type:
[Realm.App.Sync.UserIdentity, ...]
Is true if the user is logged in. False otherwise.
Type:
boolean
Gets the user's profile (name, email address, etc.).
Type:
object
Gets the provider type for the identity.
Type:
ProviderType
Gets this user's refresh token. This is the user's credential for accessing the MongoDB Realm Cloud and should be treated as sensitive data.
Type:
string
Gets the user's state which can be one of the following:
Type:
string
Methods
- callback
- Type:
function
- the provider
- name
- Type:
string
name of the function to call
- args optional repeatable
- Type:
*
arguments to pass to the function
- resolves when the function terminates.
- credentials
- Type:
Realm.Credentials
- resolves when the user has been linked with the other credentials.
- resolves when the user has been logged out
- serviceName
- Type:
string
- callback
- Type:
function
Adds a listener that will be fired on various user related events. This includes auth token refresh, refresh token refresh, refresh custom user data, and logout.
Parameters:
Realm.Auth.ApiKeyAuth
Returns a provider to interact with API keys.
Returns:Realm.Auth.ApiKeyAuth
Promise<any>
Calls the named server function as this user.
Parameters:
Promise<any>
Promise<void>
Links a user to another credentials. This is useful when linking different account together.
Parameters:
Promise<void>
Promise<void>
Logs out the user.
Returns:Promise<void>
MongoDB
Returns a connection to the MongoDB service.
Parameters:
MongoDB
Example:
let blueWidgets = user.mongoClient('myClusterName')
.db('myDb')
.collection('widgets')
.find({color: 'blue'});
Push
Promise<Object>
Refresh user's custom data.
Promise<Object>
Removes all event listeners
Removes an event listener (see addListener
)