_changes and filter

43 views
Skip to first unread message

Seung Chan Lim

unread,
Jun 3, 2014, 11:26:50 PM6/3/14
to mobile-c...@googlegroups.com
Has anyone successfully used a filter with the _changes feed of local couchbase lite in the following fashion?


I'm on phonegap, and constantly getting a 404 error with the following document in place.

{
                           filters: { 
      by_id: function(doc, req) { 
  return true;
      }.toString()
  }
  ,views: {
      profiles: {
  map: function(doc) {
      if (doc.roles.indexOf('profile') != -1) {
  emit(doc._id, doc['first name']);
      }
  }.toString()
      }
  }
}

I've intentionally gutted out the filter function to just return true for the sake of testing the bare minimum.

The views, by the way, works just fine.

slim

Seung Chan Lim

unread,
Jun 3, 2014, 11:27:25 PM6/3/14
to mobile-c...@googlegroups.com
The _id of the document is "_design/utils"

J. Chris Anderson

unread,
Jun 6, 2014, 6:10:59 PM6/6/14
to mobile-c...@googlegroups.com


On Tuesday, June 3, 2014 8:26:50 PM UTC-7, Seung Chan Lim wrote:
Has anyone successfully used a filter with the _changes feed of local couchbase lite in the following fashion?


I don't rely on this in any of the apps I've written. It looks like it should work based on the iOS implementation. Are you on iOS or Android?

Traun Leyden

unread,
Jun 6, 2014, 7:02:06 PM6/6/14
to mobile-c...@googlegroups.com
That should also work on Android.


--
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/c2243b00-f4d4-4d73-b006-95c0187959a8%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Seung Chan Lim

unread,
Jun 8, 2014, 12:02:00 AM6/8/14
to mobile-c...@googlegroups.com
I'm on iOS.
Reply all
Reply to author
Forward
0 new messages