cloudant - Couchdb Update queries read arrays as strings? -


i have made updatehandler on cloudant(couchdb) as

"_id": "_design/updatevalues",  "updates": {    "change": function(doc, req) {          var id = req.query.id;          var section = req.query.section;          if(section[0]==something) {                   //update values          } 

req.query.section array has values ["mango", "apple", "banana"]. when trying read query in database section[0], instead of getting mango(1st element in array) getting '[' first character.

i have double checked array on node server, , works totally fine there. it's on database side acting bit weird.

what causing this? how can access different 'elements' in array , not characters?

sounds req.query.section string encoded json. try making array using json object, https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/json/parse.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -