Already opened on current thread with different schema


#1

const databaseOptions = {
path: ‘realmT4.realm’,
schema: [Schema1,Schema2,Schema3],
schemaVersion: 0
};

Possible Unhandled Promise Rejection (id: 0): Error: Realm at path ‘/data/data/com.abc/files/realmT4.realm’ already opened on current thread with different schema.

Usage

const getUserModel = async () => {
const realm = await Realm.open(databaseOptions);
let people = realm.objects(‘USER’);

if(people.length > 0) {
    return people[0];
}

}

even I have used realm.close() but no avail. between I am using databaseOptions in other files as well.


#2

Did you change the models? Doesn’t this error mean that you need migration code?
I’m just guessing…