That error indicates you are accessing the query on the wrong thread (it needs to be run on the same thread that the database was created on). You should see a message like this as well:
***** THREAD-SAFETY VIOLATION: This database is being used on a thread it wasn’t “
” created on! Please see the concurrency guidelines in the Couchbase Lite "
"documentation. *****