Realm.App

The class represents a MongoDB Realm App.

let app = new Realm.App(config);

Related Classes

Sync
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 Realm.App(configOrId)

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

Parameters:
  • configOrId
    • Type: AppConfiguration or string
    • The configuration of the app or a string app id.

Throws:
  • If no app id is provided.

getApp(appId)Realm.App

Returns an instance of an app. If an app with the specified id hasn't been created, a new app instance will be created.

Parameters:
  • appId
    • Type: string
Returns: Realm.App
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.