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

NAPI: Return a non-configurable property and its value for getOwnPropertyDescriptors

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      A nice idiomatic interface to objects read from a Realm

      Expected Results

      I expect all properties defined in the schema to be returned from Object.getOwnPropertyDescriptors(objectFromRealm) to equal:

      { value: "The actual value ...",
           writable: true,
           enumerable: true,
           configurable: false }
      

      Actual Results

      The actual implementation returns

      { value: undefined,
           writable: false,
           enumerable: true,
           configurable: true }
      

      Offending code is https://github.com/realm/realm-js/blob/napi/src/node/node_class.hpp#L848-L865.

      Steps to Reproduce & Code Sample

      const Realm = require("realm");
      
      const realm = new Realm({
          schema: [{ name: "Person", properties: { name: "string" } }],
      });
      
      realm.write(() => {
          realm.create("Person", { name: "Joe" });
      });
      
      const persons = realm.objects("Person");
      for (const person of persons) {
          console.log(Object.getOwnPropertyDescriptors(person));
      }
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 3.7.0-alpha.0
      • Node or React Native: Node.js
      • Client OS & Version: Mac
      • Which debugger for React Native: None

            Assignee:
            lubo.blagoev@mongodb.com Lubo Blagoev
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: