How to make a synchronous query with MobileFirst JSONStore

116 views Asked by At

I'm just learning how to use JSONStore for mobile local data in an hybrid application. I didn't find any way to query JSONStore synchronously. I mean as I would select from a relational one.
Is it possible? Or is the only option to use the returned promise (that's asynchronous, I guess)?

1

There are 1 answers

1
Yoel Nunez On

The short answer, you cannot run JSONStore synchronously. This guarantees the JS execution is not stopped if the querying takes a long time. User experience may be impacted if you are for example trying to search a large collection with an encrypted JSONStore instance.

JSONStore uses SQLite under the hood for Android and iOS so it is a relational database. On the other hand, if you were to do that operation in Android for example you will be using an AsyncTask or something similar that would perform those operations that can take more time in a separate thread.

Some of this information you may already know already. I hope this answers your question.