Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-244

Need better documentation/examples for partially synced Realms

      Goals

      Get up and running with the Realm Platform.

      Expected Results

      I have a Realm Object server running in the cloud and my local app intelligently syncs with it.

      Actual Results

      There's hardly any documentation, and what documentation we have is incomplete.

      Steps to Reproduce

      Pretend you know nothing about Realm and try to get working a partially synced server to the Realm Platform. You won't be able to. It's too poorly documented.

      See these stack overflow issues demonstrating people have no idea how to set up partial syncing:

      https://stackoverflow.com/questions/48404807/how-should-synchronised-realm-actually-work
      https://stackoverflow.com/questions/49169199/realm-react-native-partial-sync-not-working-in-offline-mode-and-objectforprimary

      Code Sample

      This is the best minimal react example with partial syncing that it's possible to come up with after doing tons of Google searches. It still doesn't work but simply hangs forever:

      iimport React from "react";
      import Realm from "realm";
      
      const TickerSchema = {
        name: "Ticker",
        primaryKey: "tickerSymbol",
        properties: {
          tickerSymbol: { type: "string", optional: false },
          price: { type: "int", optional: false },
          companyName: { type: "string", optional: false }
        }
      };
      
      export default class extends React.Component {
        async componentDidMount() {
          const SERVER = "some-cloud-realm.us1.cloud.realm.io";
          const user = await Realm.Sync.User.login(`https://${SERVER}`, "test-user", "password");
      
          const realm = await Realm.open({
            sync: {
              url: `realms://${SERVER}:/default`,
              user: user
            },
            schema: [TickerSchema]
          }).catch(e => console.error(e));
      
          const results = realm.objects("Ticker").filtered("price < 11");
          const subscription = results.subscribe();
      
          console.log("Logging data...", results);
        }
        render() {
          return null;
        }
      }
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 2.12.0
      • Node or React Native: RN 55
      • Client OS & Version: IOS
      • Which debugger for React Native: Xcode

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: