When I am using the C API, I try to get a MutableDocument I previously saved from the database, modify it and save it back to db. However, When I try to modify the MutableDocument, it “terminate called after throwing an instance of ‘fleece::FleeceException’ what(): incorrect use of persistent shared keys: not in transaction
Aborted (core dumped)”. I don’t know where I am wrong or it is a bug of the C API?
my C++ code is below:
#include
#include “include/cbl++/CouchbaseLite.hh”
#include “include/cbl/CouchbaseLite.h”
int main() {
cbl::Database db(“information-state”, {"/tmp", kCBLDatabase_Create});
cbl::MutableDocument doc = db.getMutableDocument(“foo”); // document “foo” is previously saved
doc.set(“new”,10); // crash here
db.saveDocument(doc);
return 0;
}