Object reference not working after $set

I updated the schema of my Payment collection to include an optional validInvoice reference to an Invoice object.
After running a function that created the Invoice object and set it to the validInvoice parameter of Payment (insertOne on Invoice → updateOne on Payment using { “$set”: {“validInvoice”: result.insertedId }), the validInvoice property in Realm-Swift (v10.43.0) is always nil.
I tried a fresh install (and login with Apple), same result.
If I change something in the Payment object on the client, I can see it updated in the db.

The weird part is that if I update an unrelated property of that Payment object (a string or a bool) in the db, then validInvoice gets set to the right object and everything seems fine on the client, so it doesn’t look like a schema issue. The reference is fine also after restarting the app.
Also, if I query the Realm object for objects of type Invoice, they show up, they’re just not set in the validInvoice property of Payment.

Is this a bug or am I missing something?

  • note that I made the schema change (adding the Invoice collection and the validInvoice property in Payment) after running the function that added and updated the objects.

app id: billy-jgeoz