Skip to content

Instantly share code, notes, and snippets.

@ronycohen
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save ronycohen/60cf935ee279cd219db7 to your computer and use it in GitHub Desktop.

Select an option

Save ronycohen/60cf935ee279cd219db7 to your computer and use it in GitHub Desktop.
server side filtering
{
"_id": "_design/app",
"_rev": "13-1d2cab1b97b2ceb3b85ce7399a5a4c84",
"filters": "{'appfilter': function(doc) {return doc._id === '_design/app' || !doc._id.indexOf('relationstate') > -1 || !doc._id.indexOf('$email') > -1}.toString()}"
}
localDB.sync(remoteDB, options)
==>
options = {
batch_size : 1000,
live: live,
filter: 'app/appfilter',
retry : true,
filter : function(item) {
var type = factory.parse_id(item._id).type || item.type;
console.debug(type);
return type != 'forcedFreq' && type != 'preference' && type != 'exchangeType' && type != '$email' && type !='relationstate';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment