I am using realm kotlin android sdk for my app and using shared realm configuration. When I do any query I returning null always while matching data exists in database
val userId = app.currentUser!!.id
val data = realm.query<User>("userId == $0", userId)
.first()
.find()
above code always return null. Below is config code
sConfig = SyncConfiguration.Builder(app.currentUser!!, setOf(User::class))
.initialSubscriptions {
// Define the initial subscription set for the realm ...
add(realm.query(User::class,"userId == $0", app.currentUser?.id),"user",true)
}
.log(LogLevel.DEBUG)
.waitForInitialRemoteData()
.build()
realm = Realm.open(sConfig)
Sync is enabled on backend UI. I can fetch current user custom data like below
app.currentUser!!.app.currentUser!!.refreshCustomData()
val data = app.currentUser!!.app.currentUser!!.customDataAsBsonDocument()?.toJson()
but when I try to lookup same user in db it returns null. I also tried giving hardcoded db id but still not luck. Am I missing something?