ibm mobilefirst - How to properly initialize the JSON store in Worklight 6.1 -


i attempting initalize ibm worklight json store below:

//jsonstore jsonstorecollection metadata var jsonstorecollection = {};  //jsonstore jsonstorecollection metadata var collection_name = 'people';  function wlcommoninit(){       // create empty options pass     // wl.jsonstore.init function     var options = {};      //define collection , list search fields     jsonstorecollection[collection_name] = {         searchfields : {name: 'string'},     };       //initialize json store collection     wl.jsonstore.init(jsonstorecollection, options)     .then(function () {         console.log("successfully initialized json store");     })     .fail(function (errorobject) {         console.log("json store init failed :( ");     });  } 

but when run in android emulator logcat gives me "json store init failed" message. , following error:

[wl.jsonstore {"src":"initcollection", "err":-2,"msg":"provision_table_search_fields_mismatch","col":"token","usr":"jsonstore","doc":{},"res":{}} 

this implementation seems outlined in documentation, cannot initialize.

can tell me doing wrong here?

the documentation error codes here.

-2 provision_table_search_fields_mismatch

search fields not dynamic. not possible change search fields without calling destroy method or removecollection method in wl.jsonstore class before calling init method new search fields. error can occur if change name or type of search field. example: {key: 'string'} {key: 'number'} or {mykey: 'string'} {thekey: 'string'}.

no need uninstall application, follow documentation , handle error case calling removecollection or destroy. example:

wl.jsonstore.init(...) .then(function () {   //init successful }) .fail(function (error) {   //check -2   //call removecollection or destroy   //re-init new search fields }); 

you can submit feature request make easier.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -