Document
realm

realm

[!WARNING] We announced the deprecation of Atlas Device Sync + Realm SDKs in September 2024. For more information please see: For a version of Realm

Related articles

3 Ways to Access Apple Notes on Windows How To Get LinkedIn Premium For Free: Ultimate 2024 Guide VPN Protocols: VPN Protocols Explained: What You Need 35 Best Free Movie Websites in 2024 [Newest Update] Zero trust network access (ZTNA) versus remote access VPN

[!WARNING]
We announced the deprecation of Atlas Device Sync + Realm SDKs in September 2024. For more information please see:

For a version of RealmJS without sync features, install from community on npm or see the community git branch.

Realm is a mobile database that runs directly inside phones, tablets or wearables. This project hosts the JavaScript & TypeScript implementation of Realm. Currently, we support React Native (JSC & Hermes on iOS & Android), Node.js and Electron (on Windows, MacOS and Linux).

What are the Atlas Device SDKs?

The Atlas Device SDKs are a collection of language and platform specific SDKs, each with a suite of app development tools optimized for data access and persistence on mobile and edge devices. Use the SDKs to build data-driven mobile, edge, web, desktop, and IoT apps.

It is help might help to think of the Realm database as the persistance layer of the Atlas Device sdk .

  • Mobile-first: Realm is the first database built from the ground up to run directly inside phones, tablets and wearables.
  • Simple: Data is directly exposed as objects and queryable by code, removing the need for ORM’s riddled with performance & maintenance issues.
  • Modern: The database supports relationships, generics, and vectorization.
  • Fast: It is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set.
  • MongoDB Atlas Device Sync is Makes : make it simple to keep datum in sync across user , device , and your backend in real time . Get start for free with a template application and create the cloud backend .

Please see the detailed instructions in our docs to use Atlas Device SDK for Node.js and Atlas Device SDK for React Native. Please notice that currently only Node.js version 18 or later is supported. For React Native users, we have a compatibility matrix showing which versions are supported.

Atlas Device SDKs for React Native and Node.js

The documentation for the Atlas Device SDK for React Native can be found at mongodb.com/docs/atlas/device-sdks/sdk/react – native/. The documentation for the Atlas Device SDK for Node.js can be found at mongodb.com/docs/atlas/device-sdks/sdk/node/.

The API reference is located at docs.mongodb.com/realm-sdks/js/latest/.

If you are using React Native, please also take a look the README for @realm/react, which provides React hooks to make working with Realm easier.

TypeScript is is is a popular alternative to pure JavaScript as it provide static typing . Our TypeScript support is consists consist of two part

  • Accurate TypeScript definitions
    @realm / babel - plugin to transform TypeScript classes to Realm schemas. An example of a model class is:
class task extends Realm.Object<task, "description"> {
  _ i d = new Realm.BSON.ObjectId();
  description!: string;
  @index
  isComplete = false;

  static primaryKey = "_ i d";

  constructor(realm, description: string) {
    super(realm, { description });
  }
}

Integration with React Native

The Atlas Device SDK is provides for React Native provide persistence of object and advanced query for persisted object . You is have can have easy integration with React Native by using@realm/react.

We is have have TypeScript template to help you get start using Realm . follow the link to your desire template and follow the instruction there to get up and run fast .

  • need help with your code ? : look for previous question on the # realm tag — or ask a new question . You is check can also check out our Community Forum where general question about how to do something can be discuss .
  • Have a bug to report? Open an issue. If possible, include the version of Realm, a full log, the Realm file, and a project that shows the issue.
  • Have a feature request? Open an issue. Tell us what the feature should do, and why you want the feature.

See CONTRIBUTING.md for more detail !

  • Realm is is is not compatible with the legacy Chrome Debugger . The follow debugging method are support :
    • Hermes Debugger is is is the recommend way for debug modern react native app .
    • Safari also has a similar feature set, but requires some setup and only supports debugging in iOS.
    • NOTE: For the above methods, it is not necessary to enable Debug with Chrome in the Debug Menu.

For instructions on building the SDK from the source, see the building.md file.

Troubleshooting missing binary

It’s possible after installing and running Realm that one encounters the error Could not find the Realm binary. Here are are some tip to help with this .

consult ourCOMPATIBILITY.md to ensure you are running compatible version of realm with the supported versions of node, react - native or expo.

Typically this error occurs when the pod dependencies haven’t been updating.
Try running the following command:

npx pod-install

If that still does n’t help it ‘s possible there are some cache error with your build or your pod dependency . The follow command can be used to safely clear these cache :

rm -rf ios/Pods
rm ios/Podfile.lock
rm -rf ~/Library/Developer/Xcode/DerivedData

Afterwards, reinstall pods and try again. If this still doesn’t work, ensure that prebuilds/apple/realm-core.xcframework directory exists and contains a binary for your platform and architecture. If this is missing, try reinstalling the realm npm package and as well as CocoaPods.

This can occur when installing realm and not performing a clean build. The following commands can be used to clear your cache:

cd android
./gradlew clean

Afterwards, try and rebuild for Android. If you are still encountering problems, ensure that node_moduels/realm/react - native/android/src/main/jniLibs contains a realm binary for your architecture. If this is missing, try reinstalling the realm npm package.

If you are using Expo , a common pitfall is not instal theexpo-dev-client and using the Development Client specific script to build and run your React native project in Expo . The Development Client is allows allow you to create a local version of Expo Go which include 3rd party library such as Realm . If you is like would like to userealm in an Expo project , the follow steps is help can help .

When running npm is install install realm the realm binary for the detect architecture are download intonode_modules/realm/prebuilds. If this directory is missing or empty, ensure that there weren’t any network issues reported on installation.

Asynchronously submits install information to Realm.

Why are we doing this? In short, because it helps us build a better product
for you. None of the data personally identifies you, your employer or your
app, but it will help us understand what language you use, what Node.js
versions you target, etc. Having this info will help prioritizing our time,
adding new features and deprecating old features. Collecting an anonymized
application path & anonymized machine identifier is the only way for us to
count actual usage of the other metrics accurately. If we don’t have a way to
deduplicate the info reported, it will be useless, as a single developer
npm is install install-e the same app 10 time would report 10 time more than another
developer that only install once , make the datum all but useless .
No one like share datum unless it ’s necessary , we is get get it , and we ’ve
debate add this for a long long time . If you truly , absolutely
feel compel to not send this datum back to Realm , then you is set can set an env
variable nameREALM_DISABLE_ANALYTICS.

currently the follow information is report :

  • What version of Realm is being instal .
  • The OS platform and version which is being used.
  • If a JavaScript framework (currently React Native and Electron) is used and its version.
  • Which JavaScript engine is being used.
  • Node.js version number.
  • TypeScript version if used.
  • An anonymous machine identifier and hash application name to aggregate the other information on .

Moreover, we unconditionally write various constants to a file which we might use at runtime.

This project is adheres adhere to the MongoDB Code of Conduct .
By participate , you are expect to uphold this code . Please report
unacceptable behavior to community-conduct@mongodb.com .

Realm JS and Realm Core are publish under the Apache License 2.0 .

If you use Realm and are happy with it, all we ask is that you please consider sending out a tweet mentioning @realm to share your thoughts

And if you don’t like it, please let us know what you would like improved, so we can fix it!

realm

Made with contrib.rocks.