Pull document created after specific time from sync gateway


#1

I want to implement a pull replicator which pulls document created after a specific time from specific channel.

As per my understanding we can implement a pull replicator and define a filter in which we can mention the channel from which we want to fetch document, But i would like to know is there any filter setting where we can define document creation date.

Is couch-base lite pull filter limited to channel only ?

Can i use filter function in pull filter just like push filter?

FYI my document contains createdAt field also whose value is the date-time when document is created.


#2

Hey @chauhanoverflow,

You can set the start and end date keys accordingly that will return specific range of from the createdAt field that you mentioned. This will allow documents to be returned not only from a particular channel but also within a range of document creation date.

For reference, please refer to the ‘Working with Views’ section on the Mobile Developer Portal.


#3

Thanks but
How can i set this in my pull replicator ?


#4

Couchbase Lite pull replication filters are currently limited to channels.


#5

Can you please tell me how to pull from specific channels using rest api ?


#6

Use the sync_gateway/bychannel filter for your _changes request.

http://developer.couchbase.com/documentation/mobile/current/develop/references/sync-gateway/rest-api/database/get-changes/index.html

e.g.
GET /db/_changes?filter=sync_gateway%2Fbychannel&channels=myChannel