C4Document coding


#1

my code:

C4Database *db ;

C4EncryptionKey temp ;
temp.algorithm = kC4EncryptionNone;

C4DatabaseConfig *dbcon = new C4DatabaseConfig;
dbcon->flags = kC4DB_Create;
dbcon->storageEngine = NULL;
dbcon->versioning = kC4RevisionTrees;
dbcon->encryptionKey = temp;

C4Error *outError = new C4Error;

C4String dbPathSlice;
dbPathSlice = c4str(“mydb”);

db = c4db_open(dbPathSlice,dbcon,outError);
qDebug() << outError->code;
qDebug() << (db == NULL);

C4Document *doc1;

C4String doc1ID;
doc1ID = c4str(“1”);

C4RevisionFlags revisionFlags = kRevNew | kRevHasAttachments;

C4Error docErr ;

C4Slice body1 = c4str("{“name”:“ali”}");
//qDebug() << body1.buf;
//qDebug() << body1.size;

doc1 = c4doc_create(db, doc1ID, body1 , revisionFlags, &docErr );

qDebug() << docErr.code;
qDebug() << (doc1 == NULL);

out puts:

11:42:30.186284| [DB]: Opening DataFile ./mydb/db.sqlite3
0
false
25
true

issue:
why for document i have an error?
where my mistakes?