Realm~App

The class represents a MongoDB Realm App.

let app = new Realm.App(config);
auth

Auth providers. Currently only emailPassword provider is support

Example:
{
let app = new Realm.App(config);
let provider = app.auth.emailPassword;
}
new App(config)

Creates a new app and connects to a MongoDB Realm instance.

Parameters:
Throws:
  • If no app id is provided.

allUsers()Array

Returns a dictionary of alll users. Users' identity is used as key.

Returns: Array
currentUser()Realm.User

Returns the current user if any.

Returns: Realm.User The current user, null is no current user.
logIn(credentials)Promise<Realm.User>

Logs in a user.

Parameters:
Returns: Promise<Realm.User>
removeUser(user)Promise<void>

Removes the user from MongoDB Realm.

Parameters:
Returns: Promise<void>
switchUser(user)

Switches the current user.

Parameters:
Throws:
  • If user is not logged in.

AppConfiguration

This describes the options used to create a Realm.App instance.

Type:
Object
Properties:
  • id
    • Type: string
    • The id of the MongoDB Realm app.

  • url
    • Type: string
    • The URL of the MongoDB Realm end-point.

  • timeout
    • Type: number
    • General timeout (in millisecs) for requests.

LocalAppConfiguration

This describes the options used for local app configuration.

Type:
Object
Properties:
  • name
    • Type: string
    • The name of the app.

  • version
    • Type: string
    • The version of the app.