Skip to content

Commit a253991

Browse files
jeff-allen-mongokay-kim
authored andcommitted
DOCSP-1457 - Integrating compass into query null fields page
Signed-off-by: kay <kay.kim@10gen.com>
1 parent e6270a1 commit a253991

9 files changed

+129
-48
lines changed
24.1 KB
Loading
24.7 KB
Loading
24.5 KB
Loading

source/includes/driver-example-query-38.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717

1818
.. include:: /includes/fact-mws.rst
1919

20+
- id: compass
21+
content: |
22+
.. code-block:: javascript
23+
24+
[
25+
{ _id: 1, item: null },
26+
{ _id: 2 }
27+
]
28+
29+
For instructions on inserting documents in MongoDB Compass, see
30+
:doc:`Insert Documents </tutorial/insert-documents/>`.
31+
2032
- id: python
2133
content: |
2234
.. class:: copyable-code

source/includes/driver-example-query-39.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
99
db.inventory.find( { item: null } )
1010
11+
- id: compass
12+
content: |
13+
Copy the following query filter document into the
14+
:ref:`query bar <compass-query-bar>` and click
15+
:guilabel:`Find`:
16+
17+
.. class:: copyable-code
18+
.. code-block:: javascript
19+
20+
{ item: null }
21+
22+
.. figure:: /images/compass-find-null-field.png
23+
1124
- id: python
1225
content: |
1326
.. class:: copyable-code

source/includes/driver-example-query-40.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
99
db.inventory.find( { item : { $type: 10 } } )
1010
11+
- id: compass
12+
content: |
13+
Copy the following query filter document into the
14+
:ref:`query bar <compass-query-bar>` and click
15+
:guilabel:`Find`:
16+
17+
.. class:: copyable-code
18+
.. code-block:: javascript
19+
20+
{ item : { $type: 10 } }
21+
22+
.. figure:: /images/compass-find-null-type-check.png
23+
1124
- id: python
1225
content: |
1326
.. class:: copyable-code

source/includes/driver-example-query-41.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88
99
db.inventory.find( { item : { $exists: false } } )
1010
11+
- id: compass
12+
content: |
13+
Copy the following query filter document into the
14+
:ref:`query bar <compass-query-bar>` and click
15+
:guilabel:`Find`:
16+
17+
.. class:: copyable-code
18+
.. code-block:: javascript
19+
20+
{ item : { $exists: false } }
21+
22+
.. figure:: /images/compass-find-null-existence-check.png
23+
1124
- id: python
1225
content: |
1326
.. class:: copyable-code

source/includes/driver-example-query-intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
- id: compass
1313
content: |
14-
This page provides examples of |query_operations| in
14+
This page provides examples of |query_operations| using
1515
:ref:`MongoDB Compass <compass-index>`. The examples on this
1616
page use the ``inventory`` collection. Populate the
1717
``inventory`` collection with the following documents:

source/tutorial/query-for-null-fields.txt

Lines changed: 77 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ Equality Filter
6464
contain the ``item`` field whose value is ``null`` *or* that
6565
do not contain the ``item`` field.
6666

67+
- id: compass
68+
content: |
69+
The ``{ item : null }`` query matches documents that either
70+
contain the ``item`` field whose value is ``null`` *or* that
71+
do not contain the ``item`` field.
72+
6773
- id: python
6874
content: |
6975
The ``{ item : None }`` query matches documents that either
@@ -119,10 +125,10 @@ Equality Filter
119125
matches documents that either contain the ``item`` field whose
120126
value is ``null`` *or* that do not contain the ``item`` field.
121127

122-
For example, the following query returns both documents:
123-
124128
.. include:: /includes/driver-example-query-39.rst
125129

130+
The query returns both documents in the collection.
131+
126132
Type Check
127133
----------
128134

@@ -131,79 +137,98 @@ Type Check
131137
tabs:
132138
- id: shell
133139
content: |
134-
The ``{ item : { $type: 10 } }`` query matches documents that
135-
contains the ``item`` field whose value is ``null`` *only*;
136-
i.e. the value of the ``item`` field is of BSON Type ``Null``
137-
(i.e. ``10``) :
140+
The ``{ item : { $type: 10 } }`` query matches *only*
141+
documents that contain the ``item`` field whose value is
142+
``null``; i.e. the value of the ``item`` field is of
143+
:doc:`BSON Type </reference/bson-types>` ``Null``
144+
(type number ``10``) :
145+
146+
- id: compass
147+
content: |
148+
The ``{ item : { $type: 10 } }`` query matches *only*
149+
documents that contain the ``item`` field whose value is
150+
``null``; i.e. the value of the ``item`` field is of
151+
:doc:`BSON Type </reference/bson-types>` ``Null``
152+
(type number ``10``) :
138153

139154
- id: python
140155
content: |
141-
The ``{ item : { $type: 10 } }`` query matches documents that
142-
contains the ``item`` field whose value is ``null`` *only*;
143-
i.e. the value of the ``item`` field is of BSON Type ``Null``
144-
(i.e. ``10``) :
156+
The ``{ item : { $type: 10 } }`` query matches *only*
157+
documents that contain the ``item`` field whose value is
158+
``null``; i.e. the value of the ``item`` field is of
159+
:doc:`BSON Type </reference/bson-types>` ``Null``
160+
(type number ``10``) :
145161

146162
- id: java-sync
147163
content: |
148-
The ``type("item", BsonType.NULL)`` query matches documents
149-
that contains the ``item`` field whose value is ``null``
150-
*only*; i.e. the value of the ``item`` field is of BSON Type
151-
``Null`` (i.e. ``10``) :
164+
The ``type("item", BsonType.NULL)`` query matches *only*
165+
documents that contain the ``item`` field whose value is
166+
``null``; i.e. the value of the ``item`` field is of
167+
:doc:`BSON Type </reference/bson-types>` ``Null``
168+
(type number ``10``) :
152169

153170
- id: java-async
154171
content: |
155-
The ``type("item", BsonType.NULL)`` query matches documents
156-
that contains the ``item`` field whose value is ``null``
157-
*only*; i.e. the value of the ``item`` field is of BSON Type
158-
``Null`` (i.e. ``10``) :
172+
The ``type("item", BsonType.NULL)`` query matches *only*
173+
documents that contain the ``item`` field whose value is
174+
``null``; i.e. the value of the ``item`` field is of
175+
:doc:`BSON Type </reference/bson-types>` ``Null``
176+
(type number ``10``) :
159177

160178
- id: nodejs
161179
content: |
162-
The ``{ item : { $type: 10 } }`` query matches documents that
163-
contains the ``item`` field whose value is ``null`` *only*;
164-
i.e. the value of the ``item`` field is of BSON Type ``Null``
165-
(i.e. ``10``) :
180+
The ``{ item : { $type: 10 } }`` query matches *only*
181+
documents that contain the ``item`` field whose value is
182+
``null``; i.e. the value of the ``item`` field is of
183+
:doc:`BSON Type </reference/bson-types>` ``Null``
184+
(type number ``10``) :
166185

167186
- id: php
168187
content: |
169-
The ``[ item => [ $type => 10 ] ]`` query matches documents that
170-
contains the ``item`` field whose value is ``null`` *only*;
171-
i.e. the value of the ``item`` field is of BSON Type ``Null``
172-
(i.e. ``10``) :
188+
The ``[ item => [ $type => 10 ] ]`` query matches *only*
189+
documents that contain the ``item`` field whose value is
190+
``null``; i.e. the value of the ``item`` field is of
191+
:doc:`BSON Type </reference/bson-types>` ``Null``
192+
(type number ``10``) :
173193

174194
- id: perl
175195
content: |
176-
The ``{ item => { $type => 10 } }`` query matches documents that
177-
contains the ``item`` field whose value is ``null`` *only*;
178-
i.e. the value of the ``item`` field is of BSON Type ``Null``
179-
(i.e. ``10``) :
196+
The ``{ item => { $type => 10 } }`` query matches *only*
197+
documents that contain the ``item`` field whose value is
198+
``null``; i.e. the value of the ``item`` field is of
199+
:doc:`BSON Type </reference/bson-types>` ``Null``
200+
(type number ``10``) :
180201

181202
- id: ruby
182203
content: |
183-
The ``{ item => { $type => 10 } }`` query matches documents that
184-
contains the ``item`` field whose value is ``nil`` *only*;
185-
i.e. the value of the ``item`` field is of BSON Type ``Null``
186-
(i.e. ``10``) :
204+
The ``{ item => { $type => 10 } }`` query matches *only*
205+
documents that contain the ``item`` field whose value is
206+
``null``; i.e. the value of the ``item`` field is of
207+
:doc:`BSON Type </reference/bson-types>` ``Null``
208+
(type number ``10``) :
187209

188210
- id: java-sync
189211
content: |
190-
The ``type("item", BsonType.NULL)`` query matches documents
191-
that contains the ``item`` field whose value is ``null``
192-
*only*; i.e. the value of the ``item`` field is of BSON Type
193-
``Null`` (i.e. ``10``) :
212+
The ``type("item", BsonType.NULL)`` query matches *only*
213+
documents that contain the ``item`` field whose value is
214+
``null``; i.e. the value of the ``item`` field is of
215+
:doc:`BSON Type </reference/bson-types>` ``Null``
216+
(type number ``10``) :
194217

195218
- id: csharp
196219
content: |
197-
The ``Type("item", BsonType.Null)`` query using the :csharp-api:`FilterDefinitionBuilder.Type()
198-
<Overload_MongoDB_Driver_FilterDefinitionBuilder_1_Type>` method
199-
matches documents that contain the ``item`` field whose value is
200-
``null`` *only*; i.e. the value of the ``item`` field is of BSON
201-
Type ``Null`` (i.e. ``10``) :
220+
The ``Type("item", BsonType.Null)`` query using the
221+
:csharp-api:`FilterDefinitionBuilder.Type()
222+
<Overload_MongoDB_Driver_FilterDefinitionBuilder_1_Type>`
223+
method matches *only* documents that contain the ``item``
224+
field whose value is ``null``; i.e. the value of the ``item``
225+
field is of :doc:`BSON Type </reference/bson-types>` ``Null``
226+
(type number ``10``) :
202227

203228
.. include:: /includes/driver-example-query-40.rst
204229

205230
The query returns only the document where the ``item`` field has a
206-
``null`` value.
231+
value of ``null``.
207232

208233
Existence Check
209234
---------------
@@ -216,6 +241,11 @@ Existence Check
216241
The ``{ item : { $exists: false } }`` query matches documents
217242
that do not contain the ``item`` field:
218243

244+
- id: compass
245+
content: |
246+
The ``{ item : { $exists: false } }`` query matches documents
247+
that do not contain the ``item`` field:
248+
219249
- id: python
220250
content: |
221251
The ``{ item : { $exists: False } }`` query matches documents
@@ -264,8 +294,8 @@ Existence Check
264294

265295
.. include:: /includes/driver-example-query-41.rst
266296

267-
The query returns only the document that does *not* contain the
268-
``item`` field:
297+
The query only returns the document that does *not* contain the
298+
``item`` field.
269299

270-
.. seealso:: The reference documentation for the :query:`$type` and
300+
.. seealso:: Reference documentation for the :query:`$type` and
271301
:query:`$exists` operators.

0 commit comments

Comments
 (0)