0
votes

I'm using Couchbase Lite for Xamarin (android) and I would like to delete an encrypted DB. Here is my code to delete:

var databaseName = "XYZ";
var manager = Manager.SharedInstance;
manager.GetExistingDatabase(databaseName).Delete();

When I run this code I get:

Couchbase.Lite.CouchbaseLiteException: Error 21, 26 (file is encrypted or is not a database) executing sql 'CREATE TABLE docs ( doc_id INTEGER PRIMARY KEY, docid TEXT UNIQUE NOT NULL)'

I know the database exists and is encrypted.

The docs don't specify that deleting only works on unencrypted databases. http://developer.couchbase.com/documentation/mobile/1.3/develop/references/couchbase-lite/couchbase-lite/database/database/index.html

Is there a different way to delete an encrypted database?

1

1 Answers

0
votes

The correct way to do this is instead of

 manager.GetExistingDatabase(databaseName).Delete();

do

manager.DeleteDatabase(databaseName);

This allows for deletion of an encrypted couchbase lite DB without having the key.