@@ -14,18 +14,55 @@ Schema
14
14
15
15
.. _schema-tab:
16
16
17
- Schema Tab
18
- ----------
19
-
20
- The :guilabel:`Schema` tab reports on the documents in the collections.
21
- The report is based on :ref:`sampling of the documents
22
- <compass-faq-sampling>` in the collection.
17
+ Schema Tab Overview
18
+ -------------------
19
+
20
+ The :guilabel:`Schema` tab provides an overview of the data type
21
+ and shape of the fields in a particular collection. Databases
22
+ and collections are visible in the left-side navigation.
23
+
24
+ The overview is based on :ref:`sampling <compass-faq-sampling>`
25
+ the documents in the collection. The schema overview may include
26
+ additional data about the contents of the fields, such as the
27
+ minimum and maximum values of dates and integers, the frequency of
28
+ occurrence of particular values, and the cardinality of the data.
29
+
30
+ MongoDB has a :manual:`flexible schema model
31
+ </core/data-modeling-introduction/>`, which means that some fields may
32
+ contain different types of data from one document to the next. For
33
+ example, a field named ``address`` may contain strings and integers
34
+ in some documents, objects in others, or some combination of all three.
35
+ In the case of heterogenous fields, the :guilabel:`Schema` tab shows a
36
+ breakdown of the various data types contained within the field with the
37
+ percentage of each data type represented.
38
+
39
+ In the example below, the :guilabel:`Schema` tab shows size
40
+ information about the ``test.restaurants`` collection at the top,
41
+ including the total number of documents in the collection, the
42
+ average document size, and the total disk space occupied by the
43
+ collection.
44
+
45
+ The following fields are shown with details:
46
+
47
+ - The ``_id`` field is an :manual:`ObjectId
48
+ </reference/bson-types/index.html#objectid>`. Each ObjectId
49
+ contains a timestamp, so Compass displays the range of creation times
50
+ for the sampled documents.
51
+
52
+ - The ``address`` field contains four nested fields. You
53
+ can expand the field panel to see analyses of each of the nested
54
+ fields.
55
+
56
+ - The ``borough`` field contains a string indicating the borough in
57
+ which the restaurant is located. The cardinality is low enough
58
+ that Compass can provide a graded bar of the field contents, with the
59
+ most-frequently occurring string on the left.
60
+
61
+ - The ``categories`` field contains arrays of strings. The analysis
62
+ shows the minimum, maximum, and average array lengths.
23
63
24
64
.. figure:: /images/compass/collection-schema.png
25
- :figwidth: 817px
26
-
27
- To access the :guilabel:`Schema` tab for a collection, click on a
28
- collection on the left hand pane and select the :guilabel:`Schema` tab.
65
+ :figwidth: 750px
29
66
30
67
Query Bar
31
68
---------
@@ -34,9 +71,10 @@ Query Bar
34
71
35
72
.. include:: /includes/extracts/query-bar-results.rst
36
73
37
- From the :doc:`query bar </query-bar>` in the :guilabel:`Schema` tab, you can specify the
38
- query, and if you click the :guilabel:`Options`, you can also specify
39
- query options.
74
+ Using the :doc:`query bar </query-bar>` in the :guilabel:`Schema` tab,
75
+ you can create a query filter to limit your result set. Click the
76
+ :guilabel:`Options` button to specify query options, such as the
77
+ particular fields to display and the number of results to return.
40
78
41
79
.. figure:: /images/compass/query-bar-schema-view.png
42
80
:figwidth: 730px
@@ -48,27 +86,30 @@ query options.
48
86
In the :guilabel:`Schema` tab, you can also use the :ref:`build-query` to
49
87
enter a query into the query bar.
50
88
51
- Charts
52
- ------
89
+ Field Descriptions
90
+ ------------------
53
91
54
- For a field, Compass displays the data types and values with various
55
- charts. The data type information is on the left hand side; the field
56
- value information is on the right.
92
+ For each field, Compass displays summary information about the data
93
+ type or types the field contains and the range of values. Depending
94
+ on the data type and the level of cardinality, Compass displays
95
+ histograms, graded bars, geographical maps, and sample data to provide
96
+ a sense of the shape and scope of the data contained in each field.
57
97
58
- Field with Single Type Values
98
+ Field with a Single Data Type
59
99
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60
100
61
- Below is an example of a chart showing a field called ``last_login``
62
- which contains data of type ``date``.
101
+ Below is an example of the data type summary for a field called
102
+ ``last_login`` which contains data of type ``date``.
63
103
64
104
.. figure:: /images/compass/field-example.png
65
105
:figwidth: 330px
66
106
67
- Field with Multiple Type Values
68
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107
+ Field with Multiple Data Types
108
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
109
70
- The charts also display a percentage breakdown for fields with varying
71
- data types across documents. In the example below,
110
+ For fields that contain multiple data types,
111
+ Compass displays a percentage breakdown of
112
+ the various data types across documents. In the example below,
72
113
the chart shows the contents of a field called ``phone_no`` in which
73
114
81% of documents are of type ``string``, and the remaining 19% are of
74
115
type ``number``.
@@ -122,7 +163,7 @@ Numbers
122
163
~~~~~~~
123
164
124
165
Numbers are similar to strings in their representation.
125
- Entirely unique numbers are shown in the following manner:
166
+ Unique numbers are shown in the following manner:
126
167
127
168
.. figure:: /images/compass/number-sample.png
128
169
:figwidth: 764px
@@ -198,6 +239,9 @@ Query Builder
198
239
199
240
In the :guilabel:`Schema` tab, you can type the filter manually into
200
241
the query bar or generate the filter with the Compass query builder.
242
+ The query builder allows you to select data elements from one or more
243
+ fields in your schema and construct a query matching the selected
244
+ elements.
201
245
202
246
.. tip::
203
247
@@ -209,6 +253,9 @@ Composing ``$OR`` filter conditions is not yet possible with the
209
253
clickable query builder, but you can manually enter them in the query
210
254
bar.
211
255
256
+ The following procedure describes the steps involved in
257
+ building a complex query with the query bar.
258
+
212
259
.. include:: /includes/steps/create-query-via-builder.rst
213
260
214
261
.. note::
0 commit comments