Replication Filters in Couchbase, CouchDB and CBLite?

192 views
Skip to first unread message

Pankaj Jakhar

unread,
Mar 6, 2014, 2:45:24 AM3/6/14
to mobile-c...@googlegroups.com
I want to write separate filter in each design document in couchDB. And then I want to invoke each filter on the basis of PullReplication instance as:|

Replication pullReplication1 = mDatabaseLocal
.createPullReplication(syncUrl);
pullReplication1.setContinuous(true);

pullReplication1.setFilter("filter1/docFilter1");
// map.clear();
// map.put("text", "e");
Log.d(TAG, "Pull replication initiated.");
pullReplication1.setFilterParams(map);

pullReplication.1start();

pullReplication1.addChangeListener(this);
Replication pullReplication2 = mDatabaseLocal
.createPullReplication(syncUrl);
pullReplication2.setContinuous(true);

pullReplication2.setFilter("filter2/docFilter2");
// map.clear();
// map.put("text", "e");
Log.d(TAG, "Pull replication initiated.");
pullReplication2.setFilterParams(map);

pullReplication2.start();

pullReplication2.addChangeListener(this);
Replication pullReplication3 = mDatabaseLocal
.createPullReplication(syncUrl);
pullReplication3.setContinuous(true);

pullReplication3.setFilter("filter3/docFilter3");
// map.clear();
// map.put("text", "e");
Log.d(TAG, "Pull replication initiated.");
pullReplication3.setFilterParams(map);

pullReplication3.start();

pullReplication3.addChangeListener(this);

Is it possible to do so in CouchbaseLite based Android application? - specifying multiple filters but one filter per design document and then creating PullReplication for each filter.

Traun Leyden

unread,
Mar 11, 2014, 2:58:07 PM3/11/14
to mobile-c...@googlegroups.com
Yeah, on first glance, this should work.

Are you running into specific issues?


--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/fecb98e8-8058-4695-91c0-60e4004daf3a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Pankaj Jakhar

unread,
Mar 19, 2014, 4:51:19 AM3/19/14
to mobile-c...@googlegroups.com
Hi Traun.

In this case, one filters restrictions a set of documents from being replicated and second filter restricts second set of documents. Can it not be the case that second filter allows the documents to replicate which were restricted by first filter. And in this way, this replication rule will not work.

Jens Alfke

unread,
Mar 19, 2014, 10:04:43 AM3/19/14
to mobile-c...@googlegroups.com

On Mar 19, 2014, at 1:51 AM, Pankaj Jakhar <pankaj...@gmail.com> wrote:

In this case, one filters restrictions a set of documents from being replicated and second filter restricts second set of documents. Can it not be the case that second filter allows the documents to replicate which were restricted by first filter. And in this way, this replication rule will not work.

Then don't write your filter functions that way.

Again, if you want to know how to do something, then tell us what you're trying to do. You just gave us a big blob of code without telling us what its purpose is.

—Jens
Reply all
Reply to author
Forward
0 new messages