Flexible Sync dotnet Relationships EmbeddedObjects

I’m Currently trying to migrate my app from Partitionbased Sync to flexible Sync and ran into an Error without changing my Schema. ( I created a new App for this with flexible Sync in Atlas App Services and wanted to play around with it first). Tried to establish the Schema with Development Mode.

Currently, it says:
failed to update schema: error checking for queryable fields change: error fetching schema provider for schemas: at least two embedded schemas with different properties have the same title - “TrainingsSession” - property “exerciseForDay” has linking type “cross-collection link” in one schema and “none” in another: please terminate sync first if you wish to make changes to the embedded schemas that share a title (ProtocolErrorCode=225)

Trainingssession is an EmbeddObject that contains a list of RealmObjects (ExerciseForDay). Trainingssession itself is used in two different Places. A RealmObject (DiaryEntry ) and a EmbeddObject (TrainingsDay). Below are the relevant Classes (Only relevant Properties are displayed)

public partial class TrainingsSession : IEmbeddedObject
{
    [MapTo("_id")] public ObjectId Id { get; set; } = ObjectId.GenerateNewId();
 
    [MapTo("exercisesForDay")] [BsonIgnore] public IList<ExerciseForDay> ExercisesForDay { get; }
}
public partial class ExerciseForDay : IRealmObject, ISortable, IEntity<ObjectId>
{
    [PrimaryKey]
    [MapTo("_id")]
    [BsonElement("_id")]
    [BsonId]
    public ObjectId Id { get; set; } = ObjectId.GenerateNewId();

    [MapTo("partition")]
    [BsonElement("partition")]
    [BsonRequired]
    public string Partition { get; set; } = string.Empty;
}
public partial class DiaryEntry : IRealmObject, IEntity<ObjectId>
{
    [PrimaryKey]
    [MapTo("_id")]
    [BsonId]
    [BsonElement("_id")]
    public ObjectId Id { get; set; } = ObjectId.GenerateNewId();

    [MapTo("partition")]
    [BsonElement("partition")]
    [BsonRequired]
    public string Partition { get; set; } = string.Empty;

    [MapTo("sessions")]
    [BsonElement("sessions")]
    public IList<TrainingsSession> Sessions { get; }
}
public partial class TrainingsDay : IEmbeddedObject, IGroupable
{
    [MapTo("_id")]
    [BsonId]
    [BsonElement("_id")]
    public ObjectId Id { get; set; } = ObjectId.GenerateNewId();

    [MapTo("sessions")]
    [BsonElement("sessions")]
    public IList<TrainingsSession> Sessions { get; }
}
public partial class Week : IEmbeddedObject, IGroupable
{
    [MapTo("_id")]
    [BsonElement("_id")]
    [BsonId]
    public ObjectId Id { get; set; } = ObjectId.GenerateNewId();

    [MapTo("days")] [BsonElement("days")] public IList<TrainingsDay> Days { get; }
}
public partial class Trainingsplan : IRealmObject, IEntity<ObjectId>
{
    [PrimaryKey]
    [MapTo("_id")]
    [BsonId]
    [BsonElement("_id")]
    public ObjectId Id { get; set; } = ObjectId.GenerateNewId();

  
    [MapTo("partition")]
    [BsonElement("partition")]
    public string Partition { get; set; } = string.Empty;


    [MapTo("weeks")]
    [BsonElement("weeks")]
    public IList<Week> Weeks { get; }
}

Do i miss something with the Relationships ? The given schema worked perfectly fine with the Partitionbased sync.

Hi @Jannis_N_A,

Your schema seems correct, so it should work. Let me investigate a little and come back to you.

Hey @Jannis_N_A,

We found the cause of the error and we will try to fix it as soon as possible. In the meanwhile, as a temporary workaround, you should be able to progress by specifying the JSON schema directly in the Atlas interface. Probably the easiest way for you would be simply to copy it from your previous partition based application.

1 Like

Thank you very much for the fast reply and the solution. I will try it out!!
Is there a GitHub issue I can follow to get notified when the issue is fixed? That would be really great
Keep up the good work :+1: