No results from Realm Cloud Sync — javascript



I have an existing Realm with several ‘Documents’ records hosted for a particular user in Realm Cloud.

I can write new ‘Documents’ from the client.

But trying to sync the remote documents to my local client results in zero records.


      const config = currentUser.createConfiguration({
        sync: {
          url: 'realms://',
        schema: [DocumentSchema],
        .then((realm) => {
          const Documents = realm.objects('Documents')

          // Documents.length is 0, so this never runs.
          // However, there are 9 'Documents' on Realm Cloud, created by this same client with realm.write()
          if (Documents.length) {
            each(Documents, (document) => {


When you use query-based sync (Documents.subscribe()) you will have to wait for the server to create the partial Realm. You can do it by setting up a listener - see for the API.


Thanks @kneth.

I did get it working, but it’s really confusing.

Do the __Class, __Role, etc. objects automatically add listeners?

This doesn’t work without adding Documents.addListener():

          const Documents = realm.objects('Documents')

But this does:

          const Classes = realm.objects('__Class')


__Class, etc. contains objects which are maintained automatically by ROS as they are part of the permissions system. So you don’t have to subscribe to them.


Awesome. Thanks for the clarification!