Overview
If you have an existing app built with the Stitch SDK, you should migrate your app to use the new Realm SDK. While much of the application logic and flow of information hasn't changed, there are a few changes to how it connects to the realm backend.
Nota
Esta página presenta cómo migrar del SDK de MongoDB Stitch Server al SDK de Realm JS para crear aplicaciones Node.js.
Si buscas compilar aplicaciones web, visita nuestra página de actualización de Stitch a Realm Web. Si buscas desarrollar aplicaciones con React Native, consulta nuestra página de actualización de Stitch a Realm para React Native.
Nuevas características:
El SDK de Realm Node ahora incluye Realm Database, que incluye almacenamiento de objetos local y la capacidad de sincronizar cambios de documentos entre dispositivos a través de Internet.
Cambios
What's Changed? | Solución |
|---|---|
Las conexiones de la aplicación backend a las que anteriormente se accedía a través de Cliente de StitchAppya están disponibles a través de Realm.App. Usa el | Migrate all occurrences of |
StitchUser was previously the interface to access application users, but now it is Realm.User. | Migrate all occurrences of |
The login API has changed from stitchAppClient.auth.loginWithCredential() to Realm.App.logIn() | Rewrite all authentication logic to use the new login API. |
The API to log users out has changed from stitchAppClient.auth.logout() to Realm.User.logOut(). | Rewrite the application logic to log out using the |
El SDK de Stitch requería que los desarrolladores importaran credenciales de autenticación desde el "mongodb-stitch-server-sdk". El SDK de Realm tiene una clase, Realm.Credentials, que crea credenciales para cada proveedor de autenticación. | Replace imports of authentication credentials with method calls for each respective authentication provider through the |
En lugar de llamar a las funciones de Atlas usando el cliente de la aplicación directamente a través del método Stitch SDK stitchAppClient.callFunction(),llama Llama a las funciones del servidor de Realm utilizando el método callFunction() de un | Llame a Atlas Functions usando |
The interface to the MongoDB Data Access API, containing objects like MongoDatabase, and MongoCollection, has changed. Through Stitch, passing the RemoteMongoClient.Factory and the string "mongodb-atlas" to StitchAppClient.getServiceClient() would create a remote Mongodb client. The Realm JS SDK creates a remote MongoDB client through the Realm.User.mongoClient method on the user object. | Reemplace todas las instancias |
Convierte las referencias a servicios de terceros (AWS o Twilio) en tu aplicación de Stitch en funciones Realm de tu aplicación Realm usando los paquetes npm correspondientes. Para más información, consulta Agregar dependencias externas. |