Uploaded image for project: 'Realm Dart SDK'
  1. Realm Dart SDK
  2. RDART-1050

Sync support for Nested maps.

      Problem

      I am using realm with device sync and have been waiting for MAP support for long.
      Currently I am able to sync simple (single level maps) .

      For Example :

      @RealmModel()
      class _TodoModel {
      @PrimaryKey()
      @MapTo('_id')
      late ObjectId id;
      late String title;
      late String description;
      late String userId;
      late List<$Notes> notes;
      late Map<String, RealmValue> metaData;
      }
      
       final metaData = RealmMap(
        {  
             'title' :  RealmValue.from("title string"),
             'description' : RealmValue.from("description)'
        };
      );
      
      final newTodo =
          TodoModel(
            ObjectId(), 
            todo.title, 
            todo.description,
            todo.userId,
              metaData: metaData
      );
      
      RealmConfig.instance.realm.write(() {
        RealmConfig.instance.realm.add(newTodo);
      });
      

      I am able to write this and the sync is working properly .

      I am not able to figure out how to handle the nexted maps, like

        final mapData = {
        "title" : 'xyz',
        "age",: 12,
        "dob" : DateTime.now(),
        'metaData' : {
           "a": 'a',
           "b" : 'b'
         }
      }
      

      The write operation is successful on local realm initially, but is removed with a log on atlas
      received a collection value on primitive-only mixed field.

      Am I doing something wrong or is it the expected behavior ??

      Solution

      No response

      Alternatives

      No response

      How important is this improvement for you?

      Would be a major improvement

      Feature would mainly be used with

      Atlas Device Sync

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

              Created:
              Updated: