A newer version of this documentation is available.

View Latest

Import Filter Configuration

      +
      Pre-3.0 Legacy Configuration Equivalents

      This content describes configuration for Sync Gateway 3.0 and higher — for legacy configuration, see: Legacy Pre-3.0 Configuration

      Upsert Import Filter Function

      https:://{sgw-uri}/{db}/_config/import_filter

      Use this convenience endpoint to add or update the import_filter Javascript function for an existing Sync Gateway database.

      See the 'Model' below for more info

      Sync Gateway Roles Required (CBS 7.0.2 Developer Preview):

      • Sync Gateway Architect

      See: Import filter for more.

      Parameters

      Type Name Description Schema

      Path

      db
      required

      Database name

      string

      Body

      import_filter
      required

      The Javascipt code for the import filter function

      Import_filter_model

      Responses

      HTTP Code Description Schema

      200

      OK

      Import_filter_model

      401

      401 - Unauthorized - Error validating credentials

      No Content

      Schema

      This section shows Sync Gateway’s import control configuration settings in schema format for convenience in constructing JSON models for use in the Admin REST API.

      The configuration settings described here are provisioned through the Access Control endpoints.

      Import_filter_model

      The import_filter controls whether a document written to the Couchbase Server bucket should be made available to Couchbase Mobile clients (that is, whether it ought to be imported).

      You should provision the filter as a Javascript function in the request body of a call to the Admin Rest API endpoint put {db}/_config/import_filter.

      Set the header’s content type to content-Type: application/javascript.

      The function takes the document body as parameter and is expected to return a boolean to indicate whether the document should be imported.

      If you do not provide a filter function then no filter will be applied and ALL documents will be imported.

      Type : string