Realm schema coordinates issue only with MacOSt

I am developing a flutter app which uses 2DSphere coordinates in the schema and queries them. I have an index on the coordinates (2dsphere), and the schema and schemas.dart works fine on the iOS simulator and iPhone. When I test on MacOS desktop I get the following exception:

flutter: 2023-06-04T14:00:05.236643: [ERROR] Realm: Connection[1]: Session[1]: Error integrating bootstrap changesets: Failed to transform received changeset: Schema mismatch: Property 'longitude' in class 'Location' is nullable on one side and not on the other.

and of course, they don’t load into the app…

Again, I’m not seeing this under iOS. I’m not sure what changes to schema.dart and/or my realm schema to fix this.

If it helps understand the problem, the location object is embedded in another object, which is also embedded in another object.
Below is the my schema.dart fragment, and app services Schema (running in dev mode), and flutter environment:

// coordianates are LONGITUDE 1st, then LATITUDE
@RealmModel(ObjectType.embeddedObject)
class _Location {
  @MapTo('type')
  late String type;
  @MapTo('coordinates')
  late List<double> coordinates;
}
        "properties": {
          "location": {
            "title": "Location",
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "coordinates": {
                "bsonType": "array",
                "items": {
                  "bsonType": "double"
                }
              },
              "type": {
                "bsonType": "string"
              }
            }
          },
          "location_id": {
            "bsonType": "objectId"
          },
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.4 22F66 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.78.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Well , i face the same issue the schema is miss matched in app service have your schema on app service automatically build or you created it yourself ?

@Josh_Whitehouse Neither your server-side schema, or your @RealmModel mentions a property called longitude which doesn’t match the error message you have send.

Anyway, the error message tells you, that there is a type mismatch between server and client for the property longitude on Location. One side is nullable, the other is not.

Developer mode cannot handle that for you. Only additive changes are handled automatically. Changing the type of a property is considered a destructive change.

During development I would typically nuke the wrong side (or both) when this happens, since I typically don’t care about any stored data at that point.

I am in dev mode, and it was created automatically. I’m just not sure how to resolve the mismatch, which is not a problem with iOS, just macOS.

this is how MongoDB stores longitude and latitude so their geolocation aggregate pipeline using $geoNear works.
location (object) {
type (String) : “Point” // in my case, a point, not an area
coordinates (Array, 2 doubles): [ -80.1337, 26.15987 ]
}

Iongitude is the first double in the array, latitude the second double. I am not sure how MongoDB Atlas internally represents these, but is reporting the property as longitude, even tho the schema has no such property defined. I’m also curious how this works fine under iOS, but not MacOS.

Also changing the fields to nullable in the schema.dart doesn’t fix the issue for me. I removed the collection schema definition from the app service and still enountered this message.

Yes you have an array of two doubles and a convention that the first is longitude, but there is no property called longitude. The error complains about a type mismatch on on the Location.longitude property.

Did you perhaps have that previously?

I didn’t have that property previously with this collection, no. And to reiterate, it’s working fine with iOS, but not the MacOS flutter app.