-
Type: Improvement
-
Resolution: Incomplete
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
Always
Description
I am using Flexible sync in my kotlin application.
I have a Employee model with the following schema
class EmployeeModel : RealmObject { @PrimaryKey var _id: ObjectId = BsonObjectId() var store_id: String = "" @PersistedName("is_admin") var isAdmin: Boolean = false var username: String = "" var name: String = "" @PersistedName("password") var password: PasswordModel? = null var email: String? = null var phone: String? = null @PersistedName("is_activated") var isActivated: Boolean = true @PersistedName("permission_role") var permissionRole: PermissionRoleModel? = null @PersistedName("date_created") var dateCreated: Double = System.currentTimeMillis().toDouble() @PersistedName("date_modified") var dateModified: Double = 0.0 @PersistedName("joining_date") var joiningDate: Double = 0.0 var kyc: RealmList<KycModel> = realmListOf() @PersistedName("salary_detail") var salaryDetail: EmployeeSalaryDetail? = null @PersistedName("salary_account") var salaryAccount: PaymentAccountModel? = null @PersistedName("salary_advance") var salaryAdvance: EmployeeSalaryAdvance? = null var dob: String? = null @PersistedName("reset_password_on_login") var resetPasswordOnLogin: Boolean = false @PersistedName("last_logged_on") var lastLoggedOn: Double = 0.0 }
and Password model as
class PasswordModel : EmbeddedRealmObject { var salt: String = "" var hash: String = "" }
I am using FlexibleSync and my Employee models are getting synced but all the embedded objects such as password is syncing as null
Below is the db class where initRealm is called to initialize Realm and it's subscriptions
class DbModule (private val configPreferences: ConfigPreferences) { companion object { private const val DB_NAME = "homedrop.db.realm" private const val DB_VERSION = 20L private val DB_SCHEMAS = setOf( EmployeeModel::class, PasswordModel::class, KycModel::class, EmployeeSalaryDetail::class, EmployeeSalaryAdvance::class, PaymentAccountModel::class, EmployeeSalaryAdvanceTransaction::class, PermissionRoleModel::class, SupplierModel::class, AddressModel::class, ProductModel::class, MetricModel::class, TypeModel::class, CategoryModel::class, BrandModel::class, CustomerModel::class, DiscountModel::class, PaymentTransactionModel::class, PurchaseModel::class, PurchaseProductModel::class, SaleModel::class, SaleProductModel::class, ExpenseModel::class ) } lateinit var realm: Realm suspend fun initRealm() { try { val app = provideApp() val credentials = provideCredential(configPreferences) val user = provideRealmUser(app, credentials) val syncConfiguration = provideSyncConfiguration(user) realm = Realm.open(syncConfiguration) } catch (e: Exception) { e.printStackTrace() } } private fun provideApp(): App { return App.create( AppConfiguration.Builder(BuildConfig.REALM_APP_ID).build() ) } private suspend fun provideRealmUser(app: App, credentials: Credentials): User { return app.login(credentials) } private fun provideCredential(configPreferences: ConfigPreferences): Credentials { return Credentials.jwt(configPreferences.getAdminToken()) } private fun provideSyncConfiguration(user: User): SyncConfiguration { return SyncConfiguration.Builder(user, DB_SCHEMAS) .name(DB_NAME) .schemaVersion(DB_VERSION) .initialSubscriptions { realm -> add(realm.query(BrandModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(CategoryModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(CustomerModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(DiscountModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(EmployeeModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(ExpenseModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(ProductModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(PermissionRoleModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(PurchaseModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(SaleModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(SupplierModel::class, "store_id == $0", configPreferences.getUid())) add(realm.query(TypeModel::class)) } .errorHandler { session, error -> { Log.e("syncError", "syncError", error) } } .build() } }
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
1.8.0
What Atlas App Services are you using?
Both Atlas Device Sync and Atlas App Services
Are you using encryption?
No
Platform OS and version(s)
Android 13
Build environment
No response