Skip to content

Commit 7c041eb

Browse files
authored
DOCSP-26520 readOnly Settings (#479)
* DOCSP-26520 readOnly Settings * add to TOC * add default behavior * JA edits * typo fix * add ref link
1 parent 9d8bc61 commit 7c041eb

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

source/settings.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Tasks
4343

4444
- :ref:`compass-protect-connection-strings`
4545

46+
- :ref:`compass-read-only`
47+
4648
- :ref:`compass-force-connection-options`
4749

4850
- :ref:`compass-enable-dev-tools`
@@ -64,5 +66,6 @@ Learn more
6466
/settings/config-file
6567
/settings/restrict-outgoing-connections
6668
/settings/protect-connection-strings
69+
/settings/read-only
6770
/settings/specify-read-preference-tags
6871
/settings/enable-dev-tools

source/settings/read-only.txt

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
.. _compass-read-only:
2+
3+
====================================
4+
Restrict Write Operations to MongoDB
5+
====================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
You can use the ``readOnly`` option to prevent users from performing write
16+
operations to your MongoDB deployment through |compass-short|. If you enable the
17+
``readOnly`` option, users cannot modify documents, create indexes, or specify
18+
validation rules.
19+
20+
About This Task
21+
---------------
22+
23+
By default, |compass-short| disables the ``readOnly`` option.
24+
25+
If the ``readOnly`` option is enabled, you cannot enable the following options:
26+
27+
- :ref:`enableShell <embedded-mongodb-shell>`
28+
- :ref:`enableDevtools <compass-enable-dev-tools>`
29+
30+
Procedure
31+
---------
32+
33+
You can enable the ``readOnly`` option in either:
34+
35+
- The |compass-short| :ref:`Settings panel <compass-settings-reference>`
36+
37+
- The :ref:`command line <cli-options>`
38+
39+
- A :ref:`configuration file <config-file>`
40+
41+
|compass-short| Settings Panel
42+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
44+
.. procedure::
45+
:style: normal
46+
47+
.. step:: In the |compass-short| top menu bar, click :guilabel:`MongoDB Compass`.
48+
49+
.. figure:: /images/compass/settings-panel-location.png
50+
:scale: 60%
51+
:alt: Settings panel location under the MongoDB Compass system menu
52+
53+
Alternatively, you can use keyboard shortcuts to open the
54+
:guilabel:`Settings` panel:
55+
56+
- Windows / Linux: ``Ctrl`` + ``,``
57+
58+
- Mac: ``⌘`` + ``,``
59+
60+
.. step:: In the :guilabel:`MongoDB Compass` menu, click :guilabel:`Settings`.
61+
62+
|compass-short| opens a dialog box where you can configure your |compass|
63+
settings.
64+
65+
.. step:: Toggle :guilabel:`Set Read-Only Mode`.
66+
67+
.. step:: Click :guilabel:`Save`.
68+
69+
Command Line
70+
~~~~~~~~~~~~
71+
72+
The following command starts |compass-short| from the command line and sets
73+
the ``--readOnly`` option:
74+
75+
.. code-block:: sh
76+
77+
<path-to-Compass-executable> --readOnly
78+
79+
.. note::
80+
81+
The name and filepath of the |compass-short| executable depend on your
82+
operating system.
83+
84+
Configuration File
85+
~~~~~~~~~~~~~~~~~~
86+
87+
You can specify the |compass-short| configuration file in either EJSON
88+
or YAML format. The following configurations set the
89+
``readOnly`` option to ``true``:
90+
91+
EJSON
92+
`````
93+
94+
.. code-block:: json
95+
96+
{ "readOnly": true }
97+
98+
YAML
99+
````
100+
101+
.. code-block:: yaml
102+
103+
readOnly: true
104+
105+
Learn More
106+
----------
107+
108+
To learn more about the |compass| configuration file, see
109+
:ref:`config-file`.
110+

source/settings/settings-reference.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ You can configure the following settings on the |compass| interface:
5454
- General
5555
- Remove all write and delete capabilities on |compass-short|.
5656

57+
To learn more, see :ref:`compass-read-only`.
58+
5759
* - Enable MongoDB Shell
5860
- General
5961
- Enable or disable the embedded MongoDB Shell on |compass-short|.

0 commit comments

Comments
 (0)