Realm Javascript creates objects but returns empty object

Viewed 325

I have an existing React Native application using Realm for local data. This has worked for several years. I have now upgraded to Realm 6.0.4.

My realm is defined as follows:

const Store = {
    name: 'Store',
    properties: {
        storeId: {type: 'int'},
        storeName: {type: 'string'}
    }
};

export default new Realm({schema: [Store], schemaVersion: 20});

I write data to it as follows:

 realm.write(() => {
     realm.create('Stores', {storeId: 1, storeName: "My Store"});
 });

I try to read as follows:

 let stores = realm.objects('Stores'))

And I always get the data as empty objects:

[{}]

Even though the count of objects is correct.

Any help would be very much appreciated.

0 Answers
Related