I am trying to do something like this :
db = new LiteDatabase(@"albumdata.db");
db_string = db.GetCollection<StringPair>("strings");
db.Engine.EnsureIndex("strings", "a", true);
db_string.Upsert(new StringPair("a", "1"));
// this line throws this exception : LiteDB.LiteException: 'Cannot insert duplicate key in unique index 'a'. The duplicate value is '"a"'.'
db_string.Upsert(new StringPair("a", "1"));
But as mentioned in code I receive this error : LiteDB.LiteException: 'Cannot insert duplicate key in unique index 'a'. The duplicate value is '"a"'.'
Isn't Upsert for insert or update if it exists?