@@ -18,34 +18,20 @@ Filtered Sync
1818.. include:: /includes/api/facts/filtering-intro.rst
1919
2020Starting in 1.1, ``mongosync`` supports inclusion filters to specify which
21- databases and collections to include in sync. Starting in 1.6, ``mongosync``
22- also supports exclusion filters and regular expressions.
21+ databases and collections to include in sync.
2322
2423- With inclusion filters, ``mongosync`` syncs matching
2524 databases and collections.
26- - With exclusion filters, ``mongosync`` syncs all databases
27- and collections, except for those that match the filters.
28- - With both inclusion and exclusion filters, ``mongosync`` only syncs
29- databases and collections that match the inclusion filters then excludes
30- any that also match the exclusion filters.
3125- With no filters, ``mongosync`` syncs all databases and collections.
3226
3327.. _c2c-filter-syntax:
3428
3529Filter Syntax
3630-------------
3731
38- The :ref:`c2c-api-start` API endpoint accepts two fields that configure
39- filtered sync: ``includeNamespaces`` and ``excludeNamespaces``.
40- Each field takes an array of filters that specify the databases and collections
41- to include or exclude from sync.
42-
43- .. note::
44-
45- If the :ref:`c2c-api-start` call uses both ``includeNamespaces`` and
46- ``excludeNamespaces`` parameters, ``mongosync`` first matches databases
47- and collections from the inclusion filters, then excludes those that
48- also match an exclusion filter.
32+ The :ref:`c2c-api-start` API endpoint accepts one field to configure filtered
33+ sync: ``includeNamespaces``. This field takes an array of filters to specify
34+ the databases and collections to include in the sync.
4935
5036Filters have the following syntax:
5137
@@ -58,38 +44,10 @@ Filters have the following syntax:
5844 "collections": [
5945 "<collection-name>"
6046 ]
61- "databaseRegex": {
62- "pattern": "<regex-pattern>",
63- "options": "<options>"
64- },
65- "collectionRegex": {
66- "pattern": "<regex-pattern>",
67- "options": "<options>"
68- }
69- }
70- ],
71- "excludeNamespaces": [
72- {
73- "database": "<database-name>",
74- "collections": [
75- "<collection-name>"
76- ]
77- "databaseRegex": {
78- "pattern": "<regex-pattern>",
79- "options": "<options>"
80- },
81- "collectionRegex": {
82- "pattern": "<regex-pattern>",
83- "options": "<options>"
84- }
8547 }
8648 ]
8749
88- Filters must include either the ``database`` field or the ``databaseRegex`` field.
89-
90- If you need the filter to match specific collections, you can use either
91- the ``collections`` array to specify collections individually or define
92- a regular expression using the ``collectionRegex`` field.
50+ Filters must include the ``database`` field.
9351
9452.. _c2c-configure-filter:
9553
@@ -116,43 +74,33 @@ Configure a Filter
11674
11775 .. step:: Create a Filter.
11876
119- The :ref:`c2c-api-start` API accepts two parameters that configure
77+ The :ref:`c2c-api-start` API accepts a parameter to configure a series of
12078 optional filters:
12179
12280 - The ``includeNamespaces`` parameter takes an array of filters, which
12381 are used to determines which databases and collections ``mongosync``
12482 should include in the sync.
125- - The ``excludeNamespaces`` parameter takes an array of filters, which
126- are used to determine which databases and collections ``mongosync``
127- should exclude from the sync.
12883
12984 If you don't specify a filter, ``mongosync`` performs a full cluster
13085 sync.
13186
132- Create inclusion and/or exclusion filters to identify the databases and
87+ Create inclusion filters to identify the databases and
13388 collections you want to sync.
13489
13590 For example, this inclusion filter would configure ``mongosync`` to only
136- sync collections whose names begin with ``accounts_ `` from the ``sales``
137- database, except for the ``accounts_old`` collection:
91+ sync ``accounts_us`` and ``accounts_eu `` collections in the ``sales``
92+ database.
13893
13994 .. code-block:: json
14095
14196 "includeNamespaces": [
14297 {
14398 "database": "sales",
144- "collectionRegex": {
145- "pattern": "^accounts_.+$",
146- "options": "ms"
147- }
148- ],
149- "excludeNamespaces": [
150- {
151- "database": "sales",
152- "collections": [
153- "accounts_old"
154- ]
155- }
99+ "collections": [
100+ "accounts_us",
101+ "accounts_eu",
102+ ]
103+ }
156104 ]
157105
158106 For more information on filters, see :ref:`c2c-filter-syntax`.
@@ -350,8 +298,3 @@ Adding and Renaming Collections While Syncing
350298
351299.. include:: /includes/example-filter-collection-with-renaming.rst
352300
353- .. toctree::
354- :hidden:
355-
356- /reference/collection-level-filtering/filter-regex
357-
0 commit comments