By default when we initialize our app with realmSync, it uses the default database name (android/ios app name). But in the cloud we might have several databases and if someone wants to change the database how would he do that?
Realm only has the concept of a TableName. Each table name has a mapping to a single MongoDB Namespace (Database Name and Collection Name). The “Default Database” name is really only used when you are defining new TableNames in your SDK because we need to figure out which “database” to put it in. If you want some of your tables to be in databaseA and some to be in databaseB, then you need to define that in the Realm UI. In the “Schemas” section you can create a schema and specify the TableName->(DatabaseName, CollectionName) explicitly
Hi, I may have mixed up what you are asking. Are you referring to the mapping in the cloud of the MongoDB database name / collection name, or the file that the local realm database is stored to on the device?
This code snippet is initializing the Realm SDK in your android application. This is not defining any database yet. You can further set up the app configuration using API.
There is mostly 1 database per Realm Application on the cloud and multiple public/private realms as part of that and is segregated based on the partition strategy you define. You can have multiple databases but they are tricky to use when you have partition sync, as your partition key should be the same in all the databases.
Could you clarify more what you are trying to do and where you are stuck? Are you using Sync or only the local database? If you are using sync, do you have development mode on?
This option is only enabled for development mode. However i have defined that too but still app is automatically creating the database with app name and using it.