forked from mongodb/docs-cluster-to-cluster-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocument-filtering.txt
86 lines (61 loc) · 1.76 KB
/
document-filtering.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.. _c2c-beta-document-filtering:
==================
Document Filtering
==================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol
.. include:: /includes/beta-feature.rst
.. include:: /includes/document-filtering-intro.rst
Syntax
------
The :ref:`c2c-api-start` API endpoint accepts an optional ``documentFilter``
parameter with the following syntax:
.. code-block:: json
:copyable: false
"documentFilter" : {
"field" : <field-name>,
"matchValues" : [<field-values>]
}
Parameter Fields
----------------
.. list-table::
:header-rows: 1
* - Field
- Type
- Necessity
- Description
* - ``field``
- String
- Required
- Field name
* - ``matchValues``
- Array
- Required
- Field value(s) that a document must have in order to migrate.
Limitations
-----------
.. include:: /includes/document-filtering-limitations.rst
Examples
--------
Start ``mongosync`` with a Document Filter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. include:: /includes/intro-start-api-example-intro.rst
``cluster0`` contains the ``travel`` database, which includes the
``restaurants``, ``attractions``, and ``lodging`` collections. Documents in the
``restaurants``, ``attractions``, and ``lodging`` collections all contain a
``city`` field.
The ``documentFilter`` document in this example filters for documents where the
``city`` field is either ``Los Angeles``, ``New York``, or ``San Francisco``.
.. code-block:: json
"documentFilter" : {
field : "city",
matchValues: [ "Los Angeles", "New York", "San Francisco" ]
}
Learn More
----------
- :ref:`c2c-beta-program`
- :ref:`c2c-api-start`