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

[5.0.0] Android returns Results with length 1 but no keys or values

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      I am trying to fetch some objects from database.

      Expected Results

      Getting 1 object with all properties.

      Actual Results

      I get Results of length 1 but when getting the object via index 0, it returns no properties.

      Steps to Reproduce

      Run the code on Android

      Code Sample

      const results = realm
              .objects<ImporterAuthenticationModel>(ImporterAuthenticationModel.schema.name)
              .filtered('importerId = $0', importer.importer.id);
      
            if (results) {
              console.log(results.length);
              console.log(results[0].id);
            }
      

      Output is:

      1
      undefined
      

      Schema:

      export class ImporterAuthenticationModel extends BaseModel {
        public static schema = {
          ...BaseModel.schema,
          name: 'ImporterAuthenticationModel',
          primaryKey: 'uniqueId',
          properties: {
            ...BaseModel.schema.properties,
            uniqueId: 'string',
            id: 'string',
            title: 'string',
            subTitle: 'string?',
            imageUrl: 'string?',
            importerId: 'string',
            additionalDataString: 'string?',
            rawStatus: { type: 'int', default: ImporterAuthenticationStatus.AUTHENTICATED },
            expiresAt: 'int'
          }
        };
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 5.0.0
      • Node or React Native: React Native
      • Client OS & Version: Android 9PKQ1.181121.001 (Mi 9 Lite)
      • Which debugger for React Native: React Native Debugger (but it also fails if using production build from FireBase)

            Assignee:
            lubo.blagoev@mongodb.com Lubo Blagoev
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: