Realm~App

The class represents a MongoDB Realm App.

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

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

currentUser

Returns the current user if any.

emailPasswordAuth

Client for the email/password authentication provider.

Example:
{
// Creating a new user, by registering via email & password
const app = new Realm.App(config);
await app.emailPasswordAuth.registerUser('john@example.com', 'some-secure-password');
}
new App(config)

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

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

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.