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

Cannot insert Array of Object

      How frequently does the bug occur?

      All the time

      Description

      I have an array of objects to be insert into realmDB, I tried to console.log() it out. It is like this

      "participants": [[Object], [Object]]
      
      // example json
      [{"avatar": "https://static.chativo.io/images/avatar/001.png", "id": "5f56de52987fdb1a15615a52", "kind": "agent", "name": "1wltest4", "presence": "offline", "seen_at": "2022-01-10T10:18:49.432Z", "seen_count": 369, "visible": true}, {"avatar": "/api/v2/file/c4d8bhvt6p4e6328o8dg/IMG_20210620_115523.jpg", "id": "5f56de52987fdb1a15615a55", "kind": "agent", "name": "wltest7", "presence": "offline", "seen_at": "2022-01-10T03:51:05.005Z", "seen_count": 351, "visible": true}]
      

      Here is my code

      const RoomSchema = {
        name: 'Room',
        primaryKey: 'id',
        properties: {
          participants: 'Person[]'
        },
      };
      
      const PersonSchema = {
        name: 'Person',
        properties: {
          id: 'string?',
          kind: 'string?',
          name: 'string?',
          seen_count: 'int?',
          avatar: 'string?',
          presence: 'string?',
          visible: 'bool?'
        }
      };
      

      However, when I try to insert, it keeps throw me error.

      TypeError: undefined is not an object (evaluating 'realm.write')
      

      Please help if I done anything wrong.

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      TypeError: undefined is not an object (evaluating 'realm.write')
      

      Can you reproduce the bug?

      Yes, always

      Reproduction Steps

      No response

      Version

      10.11.0

      What SDK flavour are you using?

      Local Database only

      Are you using encryption?

      No, not using encryption

      Platform OS and version(s)

      Android 10

      Build environment

      Which debugger for React Native: ..
      Flipper

      Cocoapods version

      No response

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: