I have a database where I keep documents which contain an array field:
"userid": [
"a2f7765d-59c9-418c-9159-f99bcab060e1",
"c999655d-99c9-418c-9159-f99bcab999e2"
]
My filter function:
{
"byuserid": "function(doc,req){if(doc.userid.indexOf(req.query.user)!==-1){return true;}else{return false;}}"
}
Sync function in Android:
Map<String, Object> map = new HashMap<String, Object>();
map.put("user", mIdUser);
Replication pullReplication = pDatabase.createPullReplication(syncUrl);
pullReplication.setFilter("controls/byuserid");
pullReplication.setFilterParams(map);
pullReplication.setContinuous(true);
pullReplication.start();
When I start replication process, I get Bad chunk header.
The strange thing, I already use indexOf
or forEach
on views and everything was ok, but on filters it seems to not work.
Did I do something wrong? Or filter replication on array field is not possible?
Thanks in advance.