File tree Expand file tree Collapse file tree 3 files changed +12
-105
lines changed
includes/usage-examples/code-snippets Expand file tree Collapse file tree 3 files changed +12
-105
lines changed Original file line number Diff line number Diff line change @@ -129,51 +129,20 @@ collection:
129129- Matches documents in which the value of the ``cuisine`` field is ``"Tapas"``
130130- Returns distinct values of the ``borough`` field from the matched documents
131131
132- .. tabs::
133-
134- .. tab:: Struct
135- :tabid: structExample
136-
137- The following code uses a struct to retrieve distinct values of the
138- ``borough`` field for documents in the ``restaurants`` collection that match
139- the specified filter:
140-
141- .. io-code-block::
142- :copyable: true
143-
144- .. input:: /includes/usage-examples/code-snippets/distinct.go
145- :language: go
146- :dedent:
147-
148- .. output::
149- :language: none
150- :visible: false
151-
152- Brooklyn
153- Manhattan
154- Queens
155-
156- .. tab:: bson.D
157- :tabid: bsonDExample
158-
159- The following code uses a bson.D type to retrieve distinct values of the
160- ``borough`` field for documents in the ``restaurants`` collection that match
161- the specified filter:
162-
163- .. io-code-block::
164- :copyable: true
132+ .. io-code-block::
133+ :copyable: true
165134
166- .. input:: /includes/usage-examples/code-snippets/distinctBsonD .go
167- :language: go
168- :dedent:
135+ .. input:: /includes/usage-examples/code-snippets/distinct .go
136+ :language: go
137+ :dedent:
169138
170- .. output::
171- :language: none
172- :visible: false
139+ .. output::
140+ :language: none
141+ :visible: false
173142
174- Brooklyn
175- Manhattan
176- Queens
143+ Brooklyn
144+ Manhattan
145+ Queens
177146
178147Additional Information
179148----------------------
Original file line number Diff line number Diff line change @@ -23,11 +23,6 @@ type Restaurant struct {
2323 Grades interface {}
2424}
2525
26- // Creates a filter struct to use for the query
27- type RestaurantCuisineFilter struct {
28- Cuisine string
29- }
30-
3126func main () {
3227 if err := godotenv .Load (); err != nil {
3328 log .Println ("No .env file found" )
@@ -50,7 +45,7 @@ func main() {
5045
5146 // Filters the collection for documents where the value of cuisine is "Tapas"
5247 coll := client .Database ("sample_restaurants" ).Collection ("restaurants" )
53- filter := RestaurantCuisineFilter { Cuisine : "Tapas" }
48+ filter := bson. D {{ "cuisine" , "Tapas" } }
5449
5550 // Retrieves the distinct values of the "borough" field in documents
5651 // that match the filter
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments