Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Filtered replication not working (pull from Cloudant) #122

@adamski

Description

@adamski

I'm trying to setup a pull replication from a Cloudant db to local. If I remove the filter it does start to sync the (rather large) dataset. However with the filter I get no data.

The design document id is _design/words and the filter function looks like:

  "filters": {
    "by_category": "function(doc, req) { return doc.category == req.query.category }"
  }

I'm calling post_replicate like this

      wordStore.manager.server.post_replicate({
        body: {
          source: databaseConstants.remoteURL, 
          target: databaseConstants.dbName, 
          continuous: true,
          // selector: {    // selector is preferred in Cloudant
          //   category: 'free'
          // },
          filter: "words/by_category",
          query_params: { "category": "free" }
        }
      })

I've created a similar view which works but a) I don't think you can replicate from a view and b) filters are a lot more flexible and simpler to write.

I also tried using Cloudant's selector property but assume that is not supported in this API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions