Which var type I’ve to use in RealmObject with relation to an Array in Atlas? I’m trying Lists, ILists, [] - without any success
The question is a bit vague, but generally an IList<T>
is what you would use to represent a an array - e.g.
public class MyDocument : RealmObject
{
public IList<string> StringArray { get; }
public IList<DateTimeOffset> DateArray { get; }
}
1 Like
Thanks for the answer. When I’m using IList to create a Realm Schema from a Realm Object Model I’m getting below error:
Received: ERROR "Invalid schema change (UPLOAD): sync does not support collections of nullable primitives unless using the mixed type {table: "Talent", field: "step", type: string } - request logs URL: https://realm.mongodb.com/groups/60c1ba339ed5b853fb4d48dc/apps/614b67bf131420d9f8b7c65e/logs?co_id=615ca611c830961c864bd480" (error_code=225, try_again=false)
And the Schema is created in 50% without all the IList vars
Oh, that’s because lists of nullable types are not supported by the server yet. You need to annotate the list of strings with [Required]
so that only non-null strings are allowed in the list:
public class MyDocument : RealmObject
{
[Required]
public IList<string> StringArray { get; }
}
2 Likes
Thanks, now it’s worked
1 Like
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.