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:

Sorry for the very late reply. We have an internal bug report for that, but there is no public link for it.
I can tell you though that the issue is still not fixed.
I hope that in the meanwhile you were able to proceed and this didn’t cause much troubles!

@papafe No Problem :slight_smile:

Hi. We believe we have fixed this issue and will be deploying it this coming Thursday. If you can try to reproduce this and let us know if it is no longer an issue that would be great! If not, no worries at all.

Thanks,
Tyler

1 Like

Hi Tyler,
I will try it out and check if everything work as expected :slight_smile:
I will let you know if I find any issues.
Thanks for notifying me, that the issue is fixed. Keep up the good Work :+1:
Thanks,
Jannis

@Tyler_Kaye @papafe
Tried it out today and everything works fine :+1:
Thanks for fixing the issue and notifying :slight_smile:
Thanks,
Jannis

Thats great! I am glad to hear it.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.