-->

Does calling JSONStore.init multiple times on the

2019-03-04 17:25发布

问题:

I wanted to confirm the following:

  1. Before I call the WL.JSONStore.init method on a collection, must I first call the removeCollection method?

  2. Can I call the WL.JSONstore.init method on the same collection without getting side effects such as duplicate collections in the device's native DB?

  3. Can the WL.JSONStore.init method be thought of as a singleton method basically letting the existing collection/device's native db be ready to accept new record updates for that already existing collection?

回答1:

  1. If you want to remove the contents of a collection: init(collection1) -> removeCollection(collection1) -> init(collection1).

  2. Correct. You can do: init(collection1) -> init(collection1) -> init(collection1) -> ... without any negative side-effects.

  3. Yes.

Note: One common issue is that the search fields are not dynamic, you must call the removeCollection API first if you want to init with new search fields or additional search fields.