Get All Channel name in Couchbase Lite


#1

hi
how to make a LiveQuery over channels ?


#2

You can’t use live queries to query documents part of the same channel because the channel mappings live on the (Sync Gateway + Couchbase Server) only.

A possible workaround would be to:

  1. Use a filtered pulled replication based on a channel http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/couchbase-lite/native-api/replication/index.html#filtered_pull
  2. Use the database change listener http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/couchbase-lite/native-api/database/index.html#database-notifications or replication listener http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/couchbase-lite/native-api/replication/index.html#observing to get notified of new docs being pulled

James


#3

thanks for reply , sorry for bad question, how to LiveQuery for get all channel names(just channel names)


#4

Channel names are never synchronized to the Couchbase Lite database. This information is used by Sync Gateway only to know which user has access to what documents. However, when you create a session and subsequently get info on the session, the response contains the channels that the logged in user has access to. You could then store those channel names in a local document (which won’t get replicated).

James


#5

thanks man for your help