@@ -18,34 +18,20 @@ Filtered Sync
18
18
.. include:: /includes/api/facts/filtering-intro.rst
19
19
20
20
Starting 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.
23
22
24
23
- With inclusion filters, ``mongosync`` syncs matching
25
24
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.
31
25
- With no filters, ``mongosync`` syncs all databases and collections.
32
26
33
27
.. _c2c-filter-syntax:
34
28
35
29
Filter Syntax
36
30
-------------
37
31
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.
49
35
50
36
Filters have the following syntax:
51
37
@@ -58,38 +44,10 @@ Filters have the following syntax:
58
44
"collections": [
59
45
"<collection-name>"
60
46
]
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
- }
85
47
}
86
48
]
87
49
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.
93
51
94
52
.. _c2c-configure-filter:
95
53
@@ -116,43 +74,33 @@ Configure a Filter
116
74
117
75
.. step:: Create a Filter.
118
76
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
120
78
optional filters:
121
79
122
80
- The ``includeNamespaces`` parameter takes an array of filters, which
123
81
are used to determines which databases and collections ``mongosync``
124
82
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.
128
83
129
84
If you don't specify a filter, ``mongosync`` performs a full cluster
130
85
sync.
131
86
132
- Create inclusion and/or exclusion filters to identify the databases and
87
+ Create inclusion filters to identify the databases and
133
88
collections you want to sync.
134
89
135
90
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.
138
93
139
94
.. code-block:: json
140
95
141
96
"includeNamespaces": [
142
97
{
143
98
"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
+ }
156
104
]
157
105
158
106
For more information on filters, see :ref:`c2c-filter-syntax`.
@@ -350,8 +298,3 @@ Adding and Renaming Collections While Syncing
350
298
351
299
.. include:: /includes/example-filter-collection-with-renaming.rst
352
300
353
- .. toctree::
354
- :hidden:
355
-
356
- /reference/collection-level-filtering/filter-regex
357
-
0 commit comments