How to sync particular document from Couchbase server for mobile

I have created an application in swift. and I am using couchbase Lite in the application. I succeed to sync all document from couchbase server. but I want to sync only particular document from server. for that I googled a lot but got information about what is ‘Channels’. but I didn’t found any code how to create channels for particular document syncing.
Please let me know that how can I create and use channels for particular document syncing from couchbase server?


Channels are a Sync Gateway concept for sharding documents within a database. You can define which users can access a channel, either statically by setting the channels on the user object in the ADMIN REST API, or dynamically by giving access to the channels in the Sync Gateway sync function.

There is an overview of Sync Gateway including channels here

Here is documentation on data routing with channels

Here is documentation on the Sync Function API

If you know the document ID on the client, you can set the ReplicatorConfiguration to sync only that doc ID.

HI @pnikumbh

If you only want control a device local couchbase lite database to sync particular document, as @jens mentioned, you can set interceptor, you can filter data by documents Id to sync.
if you want to sync documents by the particular property, you can set it on filter in sync function.