Skip to content

Commit 89cd2a0

Browse files
committed
DOCSP-40206: find usageex edit (mongodb#365)
(cherry picked from commit bcbd493)
1 parent fc81726 commit 89cd2a0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

source/includes/usage-examples/code-snippets/find.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,18 @@ func main() {
5555
// is "Italian"
5656
filter := bson.D{{"cuisine", "Italian"}}
5757

58-
// Retrieves documents that match the query filer
58+
// Retrieves documents that match the query filter
5959
cursor, err := coll.Find(context.TODO(), filter)
6060
if err != nil {
6161
panic(err)
6262
}
63-
// end find
6463

64+
// Unpacks the cursor into a slice
6565
var results []Restaurant
6666
if err = cursor.All(context.TODO(), &results); err != nil {
6767
panic(err)
6868
}
69+
// end find
6970

7071
// Prints the results of the find operation as structs
7172
for _, result := range results {

source/usage-examples/find.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Find Multiple Documents
55
=======================
66

7-
.. default-domain:: mongodb
8-
97
You can find multiple documents in a collection by using the ``Find()``
108
method.
119

@@ -25,7 +23,8 @@ in the ``restaurants`` collection:
2523
:dedent:
2624

2725
The following example matches documents in the ``restaurants`` collection
28-
in which the ``cuisine`` is "Italian", returning all documents matched:
26+
in which the ``cuisine`` is ``"Italian"``, returns a cursor that
27+
references the matched documents, then unpacks the documents into a slice:
2928

3029
.. literalinclude:: /includes/usage-examples/code-snippets/find.go
3130
:start-after: begin find

0 commit comments

Comments
 (0)