I have simple PouchDB instances one for local browser and one remote. I have a design doc that takes a filter, when I issue a sync it saves as a view.
var localDB = new PouchDB('mydb');
var remoteDB = new PouchDB('http://anna:secret@127.0.0.1:5984/db');
When I execute the below it saves as a view
localDB.sync(remoteDB)
{
"_id": "_design/sync",
"_rev": "2-f6db221d90157a99f4e6e9e6e27ffe85",
"views": {
"by_user": {
"map": "function (doc) {\n emit(doc._id, 1);\n}"
}
}
}
when it is written as below on my client script
localDB.put({
_id : '_design/sync',
filters: {
by_user : function(doc, req) {
return doc._id.indexOf(req.query.user) > 0;
}.toString()
}
}).then().catch(function(err) {});
So, why can't I see filters in my document when viewed in CouchDB ?