Skip to content

Commit b0c03e5

Browse files
author
Chris Cho
authored
Merge pull request #192 from ccho-mongodb/110922-fix-code-block-indentation
Fix code-block indentation
2 parents 43d9343 + 639e596 commit b0c03e5

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

source/fundamentals/crud/read-operations/query-document.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Match criteria with a query operator use the following format:
4242

4343
.. code-block:: go
4444
:copyable: false
45-
45+
4646
filter := bson.D{{"<field>", bson.D{{"<operator>", "<value>"}}}}
4747

4848
The following sections use :ref:`literal values <golang-literal-values>`
@@ -63,7 +63,7 @@ snippet:
6363
:end-before: end insert docs
6464

6565
.. include:: /includes/fundamentals/automatic-db-coll-creation.rst
66-
66+
6767
Each document contains a rating for a type of tea and the vendors that
6868
carry them, which corresponds to the ``rating``, ``type``, and
6969
``vendor`` fields.
@@ -122,7 +122,7 @@ The following example matches documents where the ``type`` is "Oolong":
122122
the same result:
123123

124124
.. code-block:: go
125-
125+
126126
filter := bson.D{{"type", "Oolong"}}
127127

128128
.. code-block:: go
@@ -152,12 +152,12 @@ than ``7``:
152152
:language: go
153153

154154
filter := bson.D{{"rating", bson.D{{"$lt", 7}}}}
155-
155+
156156
cursor, err := coll.Find(context.TODO(), filter)
157157
if err != nil {
158158
panic(err)
159159
}
160-
160+
161161
var results []bson.D
162162
if err = cursor.All(context.TODO(), &results); err != nil {
163163
panic(err)
@@ -229,24 +229,24 @@ than ``7`` and less than or equal to ``10``:
229229
For a full list of logical operators, see the :manual:`Logical
230230
Query Operators </reference/operator/query-logical/>` page.
231231

232-
.. tip::
232+
.. tip::
233233

234234
Multiple match criteria resembling an ``$eq`` comparison operator in
235235
a literal query return the same value as the ``$and`` logical
236236
operator. For example, the following query filters produce the same result:
237237

238238
.. code-block:: go
239-
239+
240240
filter := bson.D{{"type", "Oolong"}, {"rating", 7}}
241241

242242
.. code-block:: go
243-
243+
244244
filter := bson.D{
245-
{"$and",
246-
bson.A{
247-
bson.D{{"type", "Oolong"}},
248-
bson.D{{"rating", 7}},
249-
}},
245+
{"$and",
246+
bson.A{
247+
bson.D{{"type", "Oolong"}},
248+
bson.D{{"rating", 7}},
249+
}},
250250
}
251251

252252
Element

source/fundamentals/crud/read-operations/watch.txt

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ parameter and a pipeline parameter. To return all changes, pass in an empty Pipe
5656
Example
5757
~~~~~~~
5858

59-
The following example opens a change stream on the ``tea.ratings`` collection and
59+
The following example opens a change stream on the ``tea.ratings`` collection and
6060
outputs all changes:
6161

6262
.. code-block:: go
@@ -76,13 +76,13 @@ outputs all changes:
7676
}
7777

7878
If you modify the ``tea.ratings`` collection in a separate shell, this code will print
79-
your changes. Inserting a document with a ``type`` value of ``"White Peony"`` and a
79+
your changes. Inserting a document with a ``type`` value of ``"White Peony"`` and a
8080
``rating`` value of ``4`` will output the following change event:
81-
81+
8282
.. code-block:: go
8383
:copyable: false
8484

85-
map[_id:map[_data:...] clusterTime: {...} documentKey:map[_id:ObjectID("...")]
85+
map[_id:map[_data:...] clusterTime: {...} documentKey:map[_id:ObjectID("...")]
8686
fullDocument:map[_id:ObjectID("...") rating:4 type:White Peony] ns:
8787
map[coll:ratings db:tea] operationType:insert]
8888

@@ -91,7 +91,7 @@ Modify the Change Stream Output
9191

9292
Use the pipeline parameter to modify the change stream output. This parameter allows you to
9393
only watch for certain change events. Format the pipeline parameter as an array of documents,
94-
with each document representing an aggregation stage.
94+
with each document representing an aggregation stage.
9595

9696
You can use the following pipeline stages in this parameter:
9797

@@ -125,13 +125,13 @@ new delete operations:
125125
fmt.Println(changeStream.Current)
126126
}
127127

128-
If you delete the ``tea.ratings`` document with a ``type`` value of
128+
If you delete the ``tea.ratings`` document with a ``type`` value of
129129
``"White Peony"`` in a separate shell, this code will output the following:
130130

131131
.. code-block:: go
132132
:copyable: false
133-
134-
{"_id": {"_data": "..."},"operationType": "delete","clusterTime":
133+
134+
{"_id": {"_data": "..."},"operationType": "delete","clusterTime":
135135
{"$timestamp":{"t":"...","i":"..."}},"ns": {"db": "tea","coll": "ratings"},
136136
"documentKey": {"_id": {"$oid":"..."}}}
137137

@@ -144,7 +144,7 @@ If you delete the ``tea.ratings`` document with a ``type`` value of
144144
Modify the Behavior of Watch()
145145
------------------------------
146146

147-
Use an opts parameter to modify the behavior of the ``Watch()`` method.
147+
Use an opts parameter to modify the behavior of the ``Watch()`` method.
148148

149149
You can specify the following options in the opts parameter:
150150

@@ -156,39 +156,39 @@ You can specify the following options in the opts parameter:
156156
- ``Collation``
157157
- ``StartAtOperationTime``
158158

159-
For more information on these fields, visit the
159+
For more information on these fields, visit the
160160
:manual:`MongoDB manual </reference/method/Mongo.watch/#mongodb-method-Mongo.watch>`.
161161

162162
Example
163163
~~~~~~~
164164

165-
The following example calls the ``Watch()`` method on the ``tea.ratings`` collection. It
165+
The following example calls the ``Watch()`` method on the ``tea.ratings`` collection. It
166166
specifies the ``FullDocument`` opts parameter to output a copy of the entire modified document:
167167

168168
.. code-block:: go
169169

170-
coll := client.Database("tea").Collection("ratings")
171-
opts := options.ChangeStream().SetFullDocument(options.UpdateLookup)
170+
coll := client.Database("tea").Collection("ratings")
171+
opts := options.ChangeStream().SetFullDocument(options.UpdateLookup)
172172

173-
changeStream, err := coll.Watch(context.TODO(), mongo.Pipeline{}, opts)
174-
if err != nil {
175-
panic(err)
176-
}
177-
defer changeStream.Close(context.TODO())
173+
changeStream, err := coll.Watch(context.TODO(), mongo.Pipeline{}, opts)
174+
if err != nil {
175+
panic(err)
176+
}
177+
defer changeStream.Close(context.TODO())
178178

179-
for changeStream.Next(context.TODO()) {
180-
fmt.Println(changeStream.Current)
181-
}
179+
for changeStream.Next(context.TODO()) {
180+
fmt.Println(changeStream.Current)
181+
}
182182

183-
If you update the ``rating`` value of the ``"Masala"`` tea from ``10`` to ``9``,
184-
this code outputs the following:
183+
If you update the ``rating`` value of the ``"Masala"`` tea from ``10`` to ``9``,
184+
this code outputs the following:
185185

186186
.. code-block:: go
187187
:copyable: false
188188

189189
{"_id": {"_data": "..."},"operationType": "update","clusterTime": {"$timestamp":
190190
{"t":"...","i":"..."}},"fullDocument": {"_id": {"$oid":"..."},"type": "Masala","rating":
191-
{"$numberInt":"9"}}, "ns": {"db": "tea","coll": "ratings"},"documentKey": {"_id":
191+
{"$numberInt":"9"}}, "ns": {"db": "tea","coll": "ratings"},"documentKey": {"_id":
192192
{"$oid":"..."}}, "updateDescription": {"updatedFields": {"rating": {"$numberInt":"9"}},
193193
"removedFields": [],"truncatedArrays": []}}
194194

@@ -209,4 +209,4 @@ To learn more about the ``Watch()`` method, visit the following API documentatio
209209

210210
- `Watch() for collections <{+api+}/mongo#Collection.Watch>`__
211211
- `Watch() for databases <{+api+}/mongo#Database.Watch>`__
212-
- `Watch() for clients <{+api+}/mongo#Client.Watch>`__
212+
- `Watch() for clients <{+api+}/mongo#Client.Watch>`__

0 commit comments

Comments
 (0)