This isn’t really NoSQL way of thinking.
You’re trying to match multiple fields with multiple inputs.
You’ll need to rethink it and build views that query one thing at a time.
For example if your key was:
[department_id, customer_id, name]
Then you can view all customers for a speific (or range) of department_ids, or all names from a range of customer_ids with the department_id specified. However you can’t view a range of department_ids, combined with a range of customer_ids. You have to fill the keys from left to right, including one to query the next.
startkey = [“department1”, “customer1”]
endkey = [“department1”, “customer9”]
Example “like ‘customer%’ “query”:
startkey = [“department1”, “customer”]
endkey = [“department1”, “customer”.json_decode(’”\u0fff"’)]
Odd character set in these comments, that Yen symbol or whatever should be a slash. 0fff, a high numbered character, resulting in matching anything customer*.
With this you can view all customer_ids for a department_id.
Or all departments for a customer_id.