@@ -20,57 +20,56 @@ querying documents, see :manual:`Query Documents
20
20
Set Query Filter
21
21
----------------
22
22
23
- #. In the :guilabel:`Filter` field, enter a filter document.
23
+ #. In the :guilabel:`Filter` field, enter a filter document. You can use
24
+ all of the MongoDB :manual:`query operators
25
+ </reference/operator/query/>` except the :query:`$text` and
26
+ :query:`$expr` operators.
24
27
25
- You can use all of the MongoDB
26
- :manual:`query operators </reference/operator/query/>` except
27
- the :query:`$text` and :query:`$expr` operators.
28
-
29
- .. tip::
28
+ .. example::
30
29
31
- In the :doc:`Schema </schema>` tab, you can also use the
32
- :ref:`build-query` to enter a query into the query bar.
30
+ The following filter only returns documents which have a ``Country``
31
+ value of ``Brazil``:
32
+
33
+ .. code-block:: json
34
+
35
+ { Country: "Brazil" }
33
36
34
- As you type, the :guilabel:`Find` button is disabled and the
35
- :guilabel:`Filter` label turns red until a valid query is entered.
37
+ #. .. include:: /includes/run-query.rst
36
38
37
- .. figure:: /images/querybar/query-filter-error .png
39
+ .. figure:: /images/querybar/query-filter-success .png
38
40
:figwidth: 600px
39
41
:lightbox:
40
42
41
- The Compass :guilabel:`Filter` supports using the
42
- :binary:`~bin.mongo` shell mode representation of the MongoDB
43
- Extended JSON :manual:`BSON data types </reference/mongodb-extended-json#bson-data-types-and-associated-representations>`.
43
+ .. note::
44
44
45
- .. example::
46
-
47
- The following filter returns documents where
48
- ``start_date`` is greater than than the BSON ``Date``
49
- ``2017-05-01``:
45
+ .. include:: /includes/extracts/query-bar-results.rst
50
46
51
- .. code-block:: javascript
47
+ Supported Data Types in the Query Bar
48
+ -------------------------------------
52
49
53
- { "start_date": {$gt: new Date('2017-05-01')} }
50
+ The Compass :guilabel:`Filter` supports using the
51
+ :binary:`~bin.mongo` shell mode representation of the MongoDB
52
+ Extended JSON :manual:`BSON data types </reference/mongodb-extended-json#bson-data-types-and-associated-representations>`.
54
53
55
- By specifying the ``Date`` type in both ``start_date`` and the
56
- ``$gt`` comparison operator, Compass performs the ``greater
57
- than`` comparison chronologically, returning documents with
58
- ``start_date`` later than ``2017-05-01``.
54
+ .. example::
59
55
60
- Without the ``Date`` type specification, Compass compares the
61
- ``start_dates`` as strings
62
- `lexicographically <https://en.wikipedia.org/wiki/Lexicographical_order>`_,
63
- instead of comparing the values chronologically.
56
+ The following filter returns documents where
57
+ ``start_date`` is greater than than the BSON ``Date``
58
+ ``2017-05-01``:
64
59
65
- #. .. include :: /includes/run-query.rst
60
+ .. code-block :: javascript
66
61
67
- .. figure:: /images/querybar/query-filter-success.png
68
- :figwidth: 600px
69
- :lightbox:
62
+ { "start_date": {$gt: new Date('2017-05-01')} }
70
63
71
- .. note::
64
+ By specifying the ``Date`` type in both ``start_date`` and the
65
+ ``$gt`` comparison operator, Compass performs the ``greater
66
+ than`` comparison chronologically, returning documents with
67
+ ``start_date`` later than ``2017-05-01``.
72
68
73
- .. include:: /includes/extracts/query-bar-results.rst
69
+ Without the ``Date`` type specification, Compass compares the
70
+ ``start_dates`` as strings
71
+ `lexicographically <https://en.wikipedia.org/wiki/Lexicographical_order>`_,
72
+ instead of comparing the values chronologically.
74
73
75
74
76
75
Clear the Query
@@ -89,11 +88,10 @@ How Does the Compass Query Compare to MongoDB and SQL Queries?
89
88
You have 3,235 articles. You would like to see all articles
90
89
that Joe Bloggs wrote.
91
90
92
- SQL
93
- .. code-block:: sql
91
+ Compass Filter Option
92
+ .. code-block:: javascript
94
93
95
- SELECT * FROM article
96
- WHERE author = "Joe Bloggs";
94
+ { author : { $eq : "Joe Bloggs" } }
97
95
98
96
MongoDB Aggregation
99
97
.. code-block:: javascript
@@ -102,7 +100,8 @@ How Does the Compass Query Compare to MongoDB and SQL Queries?
102
100
{ $filter : { author : { $eq : "Joe Bloggs" } } }
103
101
);
104
102
105
- Compass Filter Option
106
- .. code-block:: javascript
103
+ SQL
104
+ .. code-block:: sql
107
105
108
- { author : { $eq : "Joe Bloggs" } }
106
+ SELECT * FROM article
107
+ WHERE author = "Joe Bloggs";
0 commit comments