Skip to main content

Configuration

Enabling Stitch (now MongoDB Realm) for MongoDB involves several steps. Here's a detailed walkthrough:

Step 1: Create a MongoDB Atlas Account

  1. Visit: Go to the MongoDB Atlas website.
  2. Sign Up: If you don't have an account, sign up for one.
  3. Create Cluster: Once logged in, create a new MongoDB cluster.

Step 2: Create a Stitch App

  1. Navigate: In the MongoDB Atlas dashboard, find the "Realm" tab.
  2. Create App: Click on "Create a New App" and follow the setup wizard.
  3. Link Cluster: Link the app to the MongoDB cluster you created.

Step 3: Define Schema and Rules

  1. Open Realm UI: Navigate to the Realm UI from the Atlas dashboard.
  2. Schema: Define the schema for your MongoDB collections.
  3. Rules: Set up data access rules based on user roles or document-level permissions.

Step 4: User Authentication

  1. Authentication Providers: Choose from various providers like Email/Password, Google, Facebook, etc.
  2. Configure: Follow the steps to configure your chosen authentication method.

Step 5: Serverless Functions

  1. Navigate: Go to the "Functions" tab in the Realm UI.
  2. Create Function: Write your server-side logic using JavaScript.
  3. Deploy: Deploy the function to make it live.

Step 6: Set Up Triggers

  1. Triggers Tab: Navigate to the "Triggers" tab in the Realm UI.
  2. Create Trigger: Set up a new database trigger and link it to a function.
  3. Test: Test the trigger to ensure it works as expected.

Step 7: Client SDKs

  1. Download SDK: Download the appropriate Stitch SDK for your application (JavaScript, Android, iOS).
  2. Initialize: Initialize the Stitch client in your application code.

Step 8: Final Steps

  1. Test: Test your application thoroughly to ensure that all Realm features are working as expected.
  2. Deploy: Once testing is complete, deploy your application.

Step 9: Monitor and Debug

  1. Logs: Use the Realm logs to monitor activity and debug issues.
  2. Metrics: Use the built-in metrics to monitor usage and performance.