@@ -69,8 +69,8 @@ documentation.
6969 result, err := coll.InsertOne(
7070 context.TODO(),
7171 bson.D{
72- {"animal ", "Dog "},
73- {"breed ", "Beagle "}
72+ {"firstName ", "Aliya "},
73+ {"lastName ", "Sanders "}
7474 }
7575 )
7676
@@ -107,13 +107,13 @@ documentation.
107107 bson.D{{"firstName", "Erik"}},
108108 bson.D{{"$set", bson.D{{"age", 28}}}}
109109 )
110- fmt.Printf("The number of modified documents: %d\n", result.ModifiedCount)
110+ fmt.Printf("Number of modified documents: %d\n", result.ModifiedCount)
111111
112112 .. output::
113113 :language: go
114114 :visible: false
115115
116- The number of modified documents: 1
116+ Number of modified documents: 1
117117
118118 * - | **Update Multiple Documents**
119119 |
@@ -128,16 +128,16 @@ documentation.
128128
129129 result, err := coll.UpdateMany(
130130 context.TODO(),
131- bson.D{{"age", bson.D{{"$gte", 58 }}}},
132- bson.D{{"$set", bson.D{{"description ", "Senior "}}}}
131+ bson.D{{"age", bson.D{{"$gte", 65 }}}},
132+ bson.D{{"$set", bson.D{{"classification ", "senior "}}}}
133133 )
134- fmt.Printf("The number of modified documents: %d\n", result.ModifiedCount)
134+ fmt.Printf("Number of modified documents: %d\n", result.ModifiedCount)
135135
136136 .. output::
137137 :language: go
138138 :visible: false
139139
140- The number of modified documents: 4
140+ Number of modified documents: 4
141141
142142 * - | **Update Arrays in Documents**
143143 |
@@ -153,15 +153,15 @@ documentation.
153153 result, err := coll.UpdateMany(
154154 context.TODO(),
155155 bson.D{},
156- bson.D{{"$push", bson.D{{family , "brother "}}}}
156+ bson.D{{"$push", bson.D{{"hobbies" , "painting "}}}}
157157 )
158158
159159 .. output::
160160 :language: go
161- :visible: false
161+ :visible: false
162162
163- [{firstName Xiao}, {family ["brother "]}, ... ]
164- [{firstName Omar}, {family ["brother ", "mother "]}, ... ]
163+ [{firstName Xiao}, {hobbies ["painting "]}, ... ]
164+ [{firstName Omar}, {hobbies ["kayaking ", "painting "]}, ... ]
165165 ...
166166
167167 * - | **Replace a Document**
@@ -177,15 +177,15 @@ documentation.
177177
178178 result, err := coll.ReplaceOne(
179179 context.TODO(),
180- bson.D{{"firstName", "Mick"}},
181- bson.D{{"firstName", "Mike "}, {"lastName", "Doe "}}
180+ bson.D{{"firstName", "Mick"}, {"lastName", "Salazar"} },
181+ bson.D{{"firstName", "Michael "}, {"lastName", "Salazar Jr. "}}
182182 )
183183
184184 .. output::
185185 :language: go
186186 :visible: false
187187
188- [{{firstName Mike }, {lastName Doe } }]
188+ [{{firstName Michael }, {lastName Salazar Jr. } }]
189189
190190 * - | **Delete a Document**
191191 |
@@ -254,7 +254,7 @@ documentation.
254254 * - | **Access Data from a Cursor Iteratively**
255255 |
256256 | `API Documentation <{+api+}/mongo#Cursor.Next>`__
257- | :ref:`Cursor Guide <golang-individual-documents>`
257+ | :ref:`Retrieve Documents Individually Reference <golang-individual-documents>`
258258
259259 - .. io-code-block::
260260 :copyable: true
@@ -278,13 +278,13 @@ documentation.
278278
279279 [{firstName Doug} ... ]
280280 [{firstName Erik} ...]
281- [{lastName Chang } ...]
281+ [{firstName Oleg } ...]
282282 ...
283283
284284 * - | **Access Data from a Cursor as an Array**
285285 |
286286 | `API Documentation <{+api+}/mongo#Cursor.All>`__
287- | :ref:`Cursor Guide <golang-all-documents>`
287+ | :ref:`Retrieve All Documents Reference <golang-all-documents>`
288288
289289 - .. io-code-block::
290290 :copyable: true
@@ -303,9 +303,9 @@ documentation.
303303 :language: go
304304 :visible: false
305305
306- [{name Mike} ... ]
307- [{name Edgar} ...]
308- [{name Freddie} ...]
306+ [{firstName Mike} ... ]
307+ [{firstName Edgar} ...]
308+ [{firstName Freddie} ...]
309309 ...
310310
311311 * - | **Count Documents**
@@ -325,7 +325,7 @@ documentation.
325325 :language: go
326326 :visible: false
327327
328- 6
328+ 17
329329
330330 * - | **List Distinct Field Values**
331331 |
@@ -364,8 +364,8 @@ documentation.
364364 :language: go
365365 :visible: false
366366
367- [{breed Beagle } ... ]
368- [{breed German Shepard } ...]
367+ [{firstName Xiao } ... ]
368+ [{firstName Oleg } ...]
369369
370370 * - | **Skip Retrieved Documents**
371371 |
@@ -385,8 +385,8 @@ documentation.
385385 :language: go
386386 :visible: false
387387
388- [{item Pen } ... ]
389- [{item Chair } ...]
388+ [{firstName Sandy } ... ]
389+ [{firstName Michael } ...]
390390
391391 * - | **Sort Retrieved Documents**
392392 |
@@ -432,7 +432,7 @@ documentation.
432432 :language: go
433433 :visible: false
434434
435- [{firstName Lester}]
435+ [{firstName Lester} {lastName Franklin} ]
436436 [{firstName Wendall} {lastName Griffin}]
437437 ...
438438
@@ -458,11 +458,12 @@ documentation.
458458 .. input::
459459 :language: go
460460
461- // only searches fields with text indexes
462- cursor, err := coll.Find(context.TODO(), bson.D{{"$text", bson.D{{"$search", "beagle "}}}})
461+ // Only searches on fields covered by text indexes
462+ cursor, err := coll.Find(context.TODO(), bson.D{{"$text", bson.D{{"$search", "arts "}}}})
463463
464464 .. output::
465465 :language: go
466466 :visible: false
467467
468- [{"firstName": "Emily" , "Description": "I love to play sports and walk my beagle."} ... ]
468+ [{"firstName": "Emily" , "biography": "I am involved with arts and culture in my community."} ... ]
469+ [{"firstName": "Juan" , "biography": "I attended the School of Arts for cello performance."} ... ]
0 commit comments