Couchbase light ios - Writing to the database in validation block

Hi ,
I’m trying to create an new document that relay on other documents in the data base ,
I thought that it will be perfect if i’ll do it on the validation block ( [dataBase setValidationNamed: @“Name” asBlock: VALIDATIONBLOCK … ) but i’m getting crash , the stack looks :

0 ??? 0x03cd5678 0x0 + 63788664,
1 CouchbaseLightTest 0x0006dbb1 main + 0,
2 Foundation 0x347aaab7 + 90,
3 CouchbaseLightTest 0x000bd339 -[CBL_FMDatabase beginUse] + 180,
4 CouchbaseLightTest 0x000bcd11 -[CBL_FMDatabase executeUpdate:error:withArgumentsInArray:orVAList:] + 196,
5 CouchbaseLightTest 0x000bd215 -[CBL_FMDatabase executeUpdate:] + 40,
6 CouchbaseLightTest 0x00070b1f -[CBLDatabase(Internal) beginTransaction] + 114,
7 CouchbaseLightTest 0x00070e77 -[CBLDatabase(Internal) _inTransaction:] + 206,
8 CouchbaseLightTest 0x00090d55 -[CBLDatabase(Insertion) putRevision:prevRevisionID:allowConflict:status:] + 460,
9 CouchbaseLightTest 0x0009dff1 -[CBLDocument putProperties:prevRevID:allowConflict:error:] + 484,
10 CouchbaseLightTest 0x0009e0c7 -[CBLDocument putProperties:error:] + 82,
11 CouchbaseLightTest 0x0006e7fd __50-[RSViewController assosiateValidationToDataBase:]_block_invoke + 548,
12 CouchbaseLightTest 0x00093259 -[CBLDatabase(Insertion) validateRevision:previousRevision:parentRevID:] + 540,
13 CouchbaseLightTest 0x00091d51 __61-[CBLDatabase(Insertion) forceInsert:revisionHistory:source:]_block_invoke + 456,
14 CouchbaseLightTest 0x00070e8b -[CBLDatabase(Internal) _inTransaction:] + 226,
15 CouchbaseLightTest 0x00091a5b -[CBLDatabase(Insertion) forceInsert:revisionHistory:source:] + 582,
16 CouchbaseLightTest 0x00084379 __30-[CBL_Puller insertDownloads:]_block_invoke + 684,
17 CouchbaseLightTest 0x00070e8b -[CBLDatabase(Internal) _inTransaction:] + 226,
18 CouchbaseLightTest 0x00083f45 -[CBL_Puller insertDownloads:] + 212,
19 CouchbaseLightTest 0x0008c497 -[CBLBatcher processNow] + 198,
20 Foundation 0x347e3277 + 450,
21 CoreFoundation 0x33eaa5df + 14,
22 CoreFoundation 0x33eaa291 + 272,
23 CoreFoundation 0x33ea8f01 + 1232,
24 CoreFoundation 0x33e1bebd CFRunLoopRunSpecific + 356,
25 CoreFoundation 0x33e1bd49 CFRunLoopRunInMode + 104,
26 Foundation 0x3473ef97 + 254,
27 CouchbaseLightTest 0x0007bb07 -[CBL_Server runServerThread] + 310,
28 Foundation 0x347ebe85 + 972,
29 libsystem_c.dylib 0x3c054311 + 308,
30 libsystem_c.dylib 0x3c0541d8 thread_start + 8

It’s look like the data base is locked and that’s why i’m getting this problem , but , the validation is on one data base and the insertion is to another database, ( so why are all the databases are locked? ).

Thanks in advance ,

I notice this warning :

“This means you can’t solve latency problems just by calling part of your app code that uses Couchbase Lite on a background thread or dispatch queue. If you’re using the same Couchbase Lite instances that you use on the main thread, you will crash or corrupt the app state.
Couchbase Lite objects are not thread-safe. You cannot call them from multiple threads.”

seems that since i’m using the data base on the main thread , i can’t calling it from another - probably the validation block is called on background thread …