Schema Help, for getting arrays to realm


please could you help me getting list data and binary data from Atlas to a mobile device.

current schemas:

List Data:
  "title": "LiveDataIsaac",
  "properties": {
    "Data": {
      "bsonType": "array",
      "items": {
        "bsonType": "string"
    "DriverName": {
      "bsonType": "string"
    "TestName": {
      "bsonType": "string"
    "User": {
      "bsonType": "string"
    "_id": {
      "bsonType": "objectId"
    "_partition": {
      "bsonType": "string"
  "required": [

C# Model:

    public class LiveDataIsaac : RealmObject
        public ObjectId Id { get; set; } = ObjectId.GenerateNewId();

        public string Name { get; set; }

        public string ID { get; set; }

        public string MobileData { get; set; }

        public IList<string> Data { get; }

        public string Partition { get; set; }

thank you for all your help!

1 Like

Honestly I don’t know. I tried RealmList<string> but it didn’t create any schema for this type. Normal array doesn’t seem to be the way as you can’t just add things to it.
I made it in the simplest way and that is - create new type that inherits from EmbeddedObject. This way it’s almost like an array of values (but in fact it’s an array of objects). Not the perfect solution but I also couldn’t find an answer to the question you have.

Didn’t you already post a similar question here?

I don’t see how it’s related and I’m also interested in the answer. How do you make an array of primitive/basic type? IList clearly doesn’t work. RealmList also didn’t make it for me. I would like to know the answer too.

Good day. Did this ever get resolved @Isaac_Cragg ?
It would be quite the accomplishmen if I could do array/Lists in Realm objects, but I keep hitting this limitation on RealmObjects/Embedded objects. Which puts a frustrating hole in what I want to do. Which is embed a list in favour of needing to separate the embedded list into a separate collection. THEN merge them in the application some how.

I thought I saw a plan to do that on github but, being new-ish, it’s dabilitating to be stuck on this limitation.

While I managed to get the nested objects into Atlas and a sync to Realm I know I won’t be able to get them out easily. Once you start inheriting Embeded objects the “unsupported” errors start. Why can I even sync them if I can’t use them on the client side? I’m either using the wrong something, I’m missing something (likely) or it’s a limitation that requires some excessive writes to hack it. To much wasted time :frowning:


Do you have the exact same use case and question, which was

If so, can you present some code you’ve attempted so we can see where the issue is? If not, perhaps posting a separate question with your use case would be in order.

Hey there,

I believe it should work, as long as it matches up to the online schema, also please remember to set the primitive data arrays as required, as I think this threw an error without.

C# property:

public IList permissionIds { get; }

Mongo Schema:

“permission_ids”: {
“bsonType”: “array”,
“items”: {
“bsonType”: “string”

hope this helps,


Thanks very much @Isaac_Cragg .
I’ve been hacking around and I think while I managed ot store array’s of objects I guess, what I’m wondering is:
And forgive me if I hijack your thread, but you’re cool and helpful :wink:

When you’re writting back to a local REALM though…you have to inherrit EmbeddedObject, but Lists only allow get’s but not set’s. Which I belive means every write with a change ot the embeded list means you have to create a new recored with the list initialized in construction.

It certainly doesn’t compile using a set’s.
If that’s the case the so beit. It’s odd, but I imagine there’s a technical reason?
I’m just trying to avoid writting the workaround to a List.Add which would be wonderbar!! :wink:

Unless, I’m missing something?

Thanks for you time!!

Just as an adendum. Turns out you can’t [Require] arrays with RealmObjects.
However, I hacked around the IList issue.
I declared my properties as arrays. For example

Tender[] Payment {get; set;}

That satisfies the compiler with inheritance on RealmObject.
The hack, and I assume they’ll finish IList in another driver update, is to work with Lists and when setting the property just invoke ToArray() and vise versa (ToList()).

Having said all that, I’ve still yet to see a replication of my REALM to my client side. Some weird errors I’ve opened a case about. I think something’s bunged up :frowning: