Skip to content

Commit 83db7cd

Browse files
zach-carrjeff-allen-mongo
authored andcommitted
(DOCSP-8265-fix) Compass Import/Export improvements (#236)
* (DOCSP-8265) Update Compass import/export procedures * Updated from copy review * Add sampling note * Updates from copy review * Final copy review
1 parent b823c52 commit 83db7cd

12 files changed

+161
-78
lines changed
36.8 KB
Loading
41.3 KB
Loading
34 KB
Loading
-72.9 KB
Loading
-18.2 KB
Loading
-51 KB
Loading
114 KB
Loading
-38.1 KB
Loading

source/import-export.txt

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,46 @@ that it is formatted correctly.
4949
name: JSON
5050
content: |
5151

52-
When importing data from a **JSON** file, each document must exist on
53-
its own line in the file. Do not use commas at the end of lines to
54-
separate documents.
52+
When importing data from a **JSON** file, you can format your
53+
data as:
54+
55+
- Newline-delimited documents, or
56+
57+
- Comma-separated documents in an array
5558

5659
.. example::
5760

58-
The following ``.json`` file imports three documents:
61+
The following newline-delimited ``.json`` file is formatted
62+
correctly:
5963

6064
.. code-block:: javascript
6165

6266
{ "type": "home", "number": "212-555-1234" }
6367
{ "type": "cell", "number": "646-555-4567" }
6468
{ "type": "office", "number": "202-555-0182"}
6569

66-
|compass| automatically generates :manual:`ObjectIDs
70+
The following comma-separated ``.json`` array file is also
71+
formatted correctly:
72+
73+
.. code-block:: javascript
74+
75+
[{ "type": "home", "number": "212-555-1234" }, { "type": "cell", "number": "646-555-4567" }, { "type": "office", "number": "202-555-0182"}]
76+
77+
|compass-short| ignores line breaks in JSON arrays.
78+
79+
|compass-short| automatically generates :manual:`ObjectIDs
6780
</reference/method/ObjectId/>` for these objects on import
6881
since no ObjectIDs were specified in the initial JSON.
6982

7083
- id: csv
7184
name: CSV
7285
content: |
7386

74-
When importing data from a **CSV** file, the first line of the file
75-
must be a comma-separated list of your document field names. Subsequent
76-
lines in the file must be comma-separated field values in the order
77-
corresponding with the field order in the first line.
87+
When importing data from a **CSV** file, the first line of the
88+
file must be a comma-separated list of your document field
89+
names. Subsequent lines in the file must be comma-separated
90+
field values in the order corresponding with the field order
91+
in the first line.
7892

7993
.. example::
8094

@@ -109,9 +123,8 @@ Export Data from a Collection
109123

110124
|compass| can export data from a collection as either a
111125
**JSON** or **CSV** file. If you specify a
112-
:ref:`filter <query-bar-filter>` in the
113-
:ref:`query bar <compass-query-bar>` prior to export, |compass-short|
114-
can optionally only export documents which match the specified query.
126+
:ref:`filter <query-bar-filter>`, |compass-short| only exports
127+
documents which match the specified query.
115128

116129
Behavior
117130
~~~~~~~~
@@ -136,20 +149,6 @@ Procedure
136149

137150
.. include:: /includes/fact-export-progress-bar.rst
138151

139-
Example
140-
```````
141-
142-
The following example exports the entire ``test.people``
143-
collection as a ``.json`` file called ``test-export.json``:
144-
145-
.. figure:: /images/compass/export-data-example.png
146-
:alt: Export data example
147-
:figwidth: 600px
148-
149-
The specified ``{ age: 24 }`` query is ignored and the entire
150-
collection is exported because the
151-
:guilabel:`Export Full Collection` toggle is enabled.
152-
153152
.. tab:: Export Filtered Subset of a Collection
154153
:tabid: export-filter
155154

@@ -158,15 +157,3 @@ Procedure
158157
.. include:: /includes/steps/export-filter.rst
159158

160159
.. include:: /includes/fact-export-progress-bar.rst
161-
162-
Example
163-
```````
164-
165-
The following example a filtered subset of the
166-
``test.flightStats`` collection as a CSV file called
167-
``cvg-msp.csv``. Only documents with an ``arrivalAirportFsCode``
168-
of either ``CVG`` or ``MSP`` are included in hte export.
169-
170-
.. figure:: /images/compass/export-data-filter-example.png
171-
:alt: Export data with filter example
172-
:figwidth: 600px

source/includes/steps-export-filter.yaml

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,78 @@
1-
title: Navigate to the :doc:`collection </collections>` you wish to export data from.
1+
title: Navigate to the :doc:`collection </collections>` you wish to
2+
export data from.
23
level: 4
34
ref: select-collection
45
content: |
56
You can either select the collection from the
67
:doc:`Collections </collections>` tab or click the collection in the
78
left-hand pane.
9+
810
---
911
title: "Specify a filter in the Query Bar"
1012
level: 4
1113
ref: export-specify-filter
1214
content: |
13-
Specify a :ref:`filter <query-bar-filter>` in the :ref:`query bar <compass-query-bar>` to export only the documents which match
14-
the filter.
15+
Specify a :ref:`filter <query-bar-filter>` in the
16+
:ref:`query bar <compass-query-bar>` to export only the documents
17+
which match the filter.
18+
1519
---
16-
title: Click :guilabel:`Collection` in the top-level menu and select :guilabel:`Export Collection`
20+
title: Click :guilabel:`Collection` in the top-level menu and select
21+
:guilabel:`Export Collection`
1722
level: 4
1823
ref: export-collection
1924
content: |
20-
21-
|
22-
2325
.. figure:: /images/compass/export-data-filter-option-select.png
2426
:alt: Export data select menu
2527
2628
|compass-short| displays the following dialog:
2729
2830
.. figure:: /images/compass/export-data-dialog-filter.png
2931
:alt: Export data dialog
30-
:figwidth: 600px
32+
:width: 70%
3133
3234
The top section of the export dialog displays the query
33-
entered in the query bar.
35+
entered in the query bar. If you did not specify a query in the query
36+
bar, you can specify a query here.
37+
3438
---
35-
title: Choose the appropriate file type.
39+
title: Select document fields to include in your exported file.
3640
level: 4
37-
ref: click-file-type
41+
ref: select-export-fields
3842
content: |
39-
Under :guilabel:`Select Output File Type`, select either JSON or CSV.
43+
Only fields that are checked are included in the exported file.
44+
45+
You can add document fields to include with the :guilabel:`Add Field`
46+
button if the field you want to include is not automatically detected.
47+
48+
.. figure:: /images/compass/export-data-dialog-2.png
49+
:alt: Export data dialog, step 2
50+
:width: 70%
51+
52+
.. note::
53+
54+
|compass-short| samples your collection to pre-populate a list of
55+
fields. Fields which only appear in a small percentage of
56+
documents may not be automatically detected.
57+
58+
For details on sampling, see the :ref:`FAQ <compass-faq-sampling>`.
59+
4060
---
41-
title: Under :guilabel:`Select File`, choose where to export the file.
61+
title: Choose the appropriate file type.
4262
level: 4
43-
ref: click-file-location
63+
ref: click-file-type
64+
content: |
65+
Under :guilabel:`Select Export File Type`, select either
66+
:guilabel:`JSON` or :guilabel:`CSV`. If you select :guilabel:`JSON`,
67+
your data is exported to the target file as a comma-separated
68+
array of JSON objects.
69+
70+
Then, under :guilabel:`Output`, choose where to export the file to.
71+
72+
.. figure:: /images/compass/export-data-dialog-3.png
73+
:alt: Export data dialog, step 3
74+
:width: 70%
75+
4476
---
4577
title: Click :guilabel:`Export`.
4678
level: 4

0 commit comments

Comments
 (0)