PouchDB to CouchDB sync is not happening when I use filter design document
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
PouchDB to CouchDB sync is not happening when I use filter design document. Sync can pull the CouchDB data into PouchDB. When I update a record on the PouchDB. It's not syncing with CouchDB
### My Sync code
this.pouchDB
.sync(this.couchDB, {
live: true,
heartbeat: true,
timeout: false,
retry: true,
back_off_function: backOffFunction,
filter: 'filters/by_unit',
query_params: { units: JSON.stringify(selectedUnits) }
})
### CouchDB filter design document
{
"_id": "_design/filters",
"_rev": "1-906cb674d5e8db7ae497285df540b183",
"filters": {
"by_unit": "function(doc, req) { if (doc._id.startsWith(\"_design/\")) { return true; } var units = JSON.parse(req.query.units || '[]'); return units.indexOf(doc.unitId) !== -1; }"
}
}
### NOTE
For the same filter replicate works fine but not for sync
Contributor guide
Assessment
This issue has not been assessed yet.