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

Investigate creating Class Models outside of Realm context

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      Investigate changes needed for allowing Class Models to be initiated outside of Realm context. This is currently broken.

      Goal is to be able to initialize instances before creation etc. through Realm:

      class Test extends Realm.Object {
        _id: ObjectId;
      
        constructor() {
          super();
          this._id = new ObjectId();
        }
      
        static schema: Realm.ObjectSchema = {
          name: "Test",
          primaryKey: "_id",
          properties: {
              _id: "objectId",
          },
        };
      }
      
      const test1 = new Test();
      
      realm.write(() => {
        realm.create(TestClass, test1);
      });
      

      Currently we're seeing weird behaviour (related issues):

            Assignee:
            Unassigned Unassigned
            Reporter:
            steffen.agger@mongodb.com Steffen Agger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: