1

I am trying to pass parameters from my website to a couchdb server through a node.js server. I absolutely need to pass {} in a url. Not a string, not an empty object, the actual {} characters. It is used to define the end_key parameter in couchdb views.

At the moment, my call goes like this :

let url = "/trades";
let ajax_options = {
    data:{
        design_name:'bla',
        view_name:'blabla',
        params_view:{
            group_level:2,
            start_key:["1",0],
            end_key:["1",{}]
        }
    }
};
$.ajax(url,ajax_options).then((res) => { ... });

when it passes through NodeJs and the nano library with

db.view(req.query.design_name, req.query.view_name, req.query.params_view)

the end_key object in params_view becomes ["1"] instead of ["1",{}] which I would like to see.

I have verified that with the correct value for end_key, the view gives me the expected result.

How to prevent that behavior from occurring ?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Chapo
  • 2,563
  • 3
  • 30
  • 60

0 Answers0