How to pull replication filter?

I want to pull only filtered docs. Right now , when i pull start, it loads all docs that is more that 5-6MB. How i pull only filtered data ?

You have couple of options

  • use the docIds property on the Replicator object to filter by document Ids if you know exactly the documents of interest
  • Alternatively, use the channels property on Replicator object to filter by channels
    Then in your Sync Gateway config file’s sync function, assign the docs you want pulled by this client/user into appropriate channel that the specific user has access to. Details on how to do that is discussed in this guide

I didn’t get any good example for how to use channel . can you please provide any useful link ?

The link that I shared above describes the sync function and has many examples on how to assign documents to channels . There is sample routing code in there .

On the app side, the property is just an array of channel Ids , for instance …
replicator.channels = ["my_channel"]