I am getting an exception while opening a database in couchbase-lite.I tried using different database name and also checked for the error and referred to this link but it seems that the error is related to the databse file format, but unable to resolve it. Here is the description for the same:
Code snippet:
const config = new DatabaseConfiguration();
config.setEncryptionKey('secret');
const database = new Database("test1", config)
database.setEngine(new CordovaEngine({
allResultsChunkSize: 128
}));
this.database = database;
this.database.open();
Exception message:
CouchbaseLiteException (LiteCoreDomain / 21): file/data is not in the requested format.
Can anyone one please help to resolve the issue?
------Edit: As per suggestion I have removed encryption and tried the db-open and other things,which are working seamlessly now. But nothing works if I add encryption again,how to achieve the same with encryption any idea?
After trying multiple options what worked for me is as below:
I had to delete the existing Db file manually, because the file was corrupted.
Also used Database.Delete method after checking the existence of db
Created new Db with encryption.