After I authenticate and sync my electronapp with my database cluster using MongoDB Realm Sync, I want to open my app completely offline. How can I do that ? It works fine when I open it online. But, when I open it offline, it does not return anything , neither it gives any error.
Below is my code:
try {
await app.logIn(new Realm.Credentials.anonymous())
let config = {
schema: [DogSchema],
path: '---path----',
sync: {
user: app.currentUser,
partitionValue: '----partion-value---',
error: (error) => {
console.log(error.name, error.message)
}
}
}
let realm = await Realm.open(config)
await realm.write(() => {
const dog = realm.create('dog', {
name: `apple ${Date.now()}`,
breed: 'labra',
realm_id: '12345',
_id: new ObjectID()
})
})
let dogs = realm.objects('dog')
// realm.close()
} catch (error) {
console.error('create error-->>',error)
}