How can I write wildcard search in couchdb? I want to write query same as 'LIKE %' in sql.please help me for this.
{
"name":"arun",
"surname":"mr"
}
{
"name":"balu",
"surname":"tp"
}
I need to list all names that start with 'a'.
Thanks..
In couchdb you can query over string ranges.
First you need to have a view that emits all the names as keys
function(doc){
if(doc.name)
emit(doc.name,null);
}
Then you can query it with
http://localhost:5984/your-db-name/_design/your-ddoc-name/_view/your-view-name?startkey="a"&endkey="a\ufff0"
which will give you all the names starting with a
.
'\uff0' is just a high value unicode character, not a specific character that will perform magic tricks in couchdb.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments