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

Core 6: "Key not found" calling `realm.objects( ... )`

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      I want to open and automatically upgrade all core < 6 files with the Realm JS v4 alpha release.
      Specifically I want to open and upgrade asset_file.realm.

      Expected Results

      An upgrade of the file and no runtime errors.

      Actual Results

      A runtime error is thrown when getting a reference to the owner on the Cat objects.

      Steps to Reproduce & Code Sample

      const Realm = require('realm');
      const realm = new Realm({ path: "asset_file.realm" });
      const cats = realm.objects('Cat');
      const firstCat = cats[0];
      const firstCatOwner = firstCat.owner; //  Getting the owner of a cat throws
      console.log(firstCatOwner);
      

      Throws

      const firstCatOwner = firstCat.owner; // Getting the owner of a cat throws
                                     ^
      
      Error: Key not found
          at Object.<anonymous> (/Users/kraenhansen/Projects/delete-me/index.js:5:32)
          at Module._compile (internal/modules/cjs/loader.js:778:30)
          at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
          at Module.load (internal/modules/cjs/loader.js:653:32)
          at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
          at Function.Module._load (internal/modules/cjs/loader.js:585:3)
          at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
          at startup (internal/bootstrap/node.js:283:19)
          at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
      

      Version of Realm and Tooling

      • Realm JS SDK Version: v4.0.0-alpha.1
      • Node or React Native: N/A
      • Client OS & Version: N/A
      • Which debugger for React Native: N/A

            Assignee:
            kenneth.geisshirt@mongodb.com Kenneth Geisshirt (Inactive)
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: