Reputation: 653
I want to write a query in couchdb same as below sql.
select * from tbl_name where f_name like 'a%' or l_name like 'a%';
for the given document:
{
"f_name":"abc",
"l_name":"def"
}
I need result by using view and its should not use any list.Alternatively i want to change the field name in where case.
eg:
select * from tbl_name where f_name like 'a%' ;
select * from tbl_name where l_name like 'a';
The field name present in where condition should be dynamic.
Upvotes: 1
Views: 249
Reputation: 8368
For wildcard query, have a look here: How to write wildcard search query in couchdb where name like 'a%'
In your view, just output both f_name
and l_name
as keys, two emits that is.
Upvotes: 1