Hello, I’m trying to access new synced data in an Atlas function and there’s an issue:
- I’m creating some objects using RealmSwift on iOS
- I immediately call
try await realm.syncSession?.wait(for: .upload)
from a @MainActor async function - next, I’m calling an Atlas function that takes the new object _id and queries the db collection to get the full object
- sometimes the
findOne
call returns null, but if I retry after a few seconds it works
I tracked the time it takes for the wait(for:)
function to run and it takes a few seconds, but still when I create multiple objects at once (single write transaction) and I call the atlas function (a single call), there are always a few objects that haven’t synced and findOne
returns null.
Is there anything else I need to do be able to access the data from the function? Should I do an equivalent wait(for: .download)
there too?
Sometimes the object was found but another referenced object wasn’t.