we have an existing realm db which in the beginning of the app will be offline and filled with data.
the realm gets intialized with :
var config = new RealmConfiguration
{
SchemaVersion = CurrentVersionDB,
MigrationCallback = MigrationCallBack()
,
};
to a certain point we want to now add sync for a few (not all ) RealmObjects with our Mongo Atlas. The understanding is that we can set up now certain objects being synced with :
public static async System.Threading.Tasks.Task<Realm> SyncRealm(Realm existingRealm)
{
try
{
var myRealmAppId = "mytutorialapp-XXX";
var app = Realms.Sync.App.Create(myRealmAppId);
var user = await app.LogInAsync(Realms.Sync.Credentials.EmailPassword("XXX@level28", "PASSWORT"));
var syncConfig = new FlexibleSyncConfiguration(app.CurrentUser);
existingRealm.WriteCopy(syncConfig);
syncConfig.Schema = new[] { typeof(DBImage) };
var sRealm = Realm.GetInstance(syncConfig);
sRealm.Subscriptions.Update(() =>
{
var myImages = sRealm.All<DBImage>();
sRealm.Subscriptions.Add(myImages);
});
await sRealm.Subscriptions.WaitForSynchronizationAsync();
return sRealm;
}
catch (Exception ex)
{
var x = ex.Message;
}
return null;
}
When we run this we get a error on all other RealmObjects we did not add as a Subscription “encountered error when flushing batch: error in onBatchComplete callback: error updating resumable progress: timed out while checking out a connection from connection pool: context canceled; maxPoolSize: 20 …”
Basically we are looking for a solutions where we can on demand sync certain RealmObjects with our MongoAtlas and keep most of the data offline. Is that possible with one Realm or is it better to set up a second realm which is handling the sync with Mongo?