Skip to content

Commit 5e800e1

Browse files
committed
add expected output
1 parent afa26b3 commit 5e800e1

File tree

5 files changed

+64
-20
lines changed

5 files changed

+64
-20
lines changed

source/crud/insert.txt

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,43 @@ Select the :guilabel:`Struct` or :guilabel:`bson.D` tab to see the corresponding
149149
The following code uses a struct to insert a new document into the
150150
``restaurants`` collection:
151151

152-
.. literalinclude:: /includes/usage-examples/code-snippets/insertOne.go
153-
:language: go
154-
:dedent:
152+
.. io-code-block::
153+
:copyable: true
154+
155+
.. input::
156+
:language: go
157+
158+
.. literalinclude:: /includes/usage-examples/code-snippets/insertOne.go
159+
:language: go
160+
:dedent:
161+
162+
.. output::
163+
:language: none
164+
:visible: false
165+
166+
Document inserted with ID: ObjectID("...")
155167

156168
.. tab:: bson.D
157169
:tabid: bsonDExample
158170

159171
The following code uses a ``bson.D`` type to insert a new document into the
160172
``restaurants`` collection:
161173

162-
.. literalinclude:: /includes/usage-examples/code-snippets/insertOneBsonD.go
163-
:language: go
164-
:dedent:
174+
.. io-code-block::
175+
:copyable: true
176+
177+
.. input::
178+
:language: go
179+
180+
.. literalinclude:: /includes/usage-examples/code-snippets/insertOneBsonD.go
181+
:language: go
182+
:dedent:
183+
184+
.. output::
185+
:language: none
186+
:visible: false
187+
188+
Document inserted with ID: ObjectID("...")
165189

166190
Insert Multiple Documents
167191
-------------------------
@@ -326,19 +350,47 @@ Select the :guilabel:`Struct` or :guilabel:`bson.D` tab to see the corresponding
326350
The following code uses a struct to insert multiple new documents into the
327351
``restaurants`` collection:
328352

329-
.. literalinclude:: /includes/usage-examples/code-snippets/insertMany.go
330-
:language: go
331-
:dedent:
353+
.. io-code-block::
354+
:copyable: true
355+
356+
.. input::
357+
:language: go
358+
359+
.. literalinclude:: /includes/usage-examples/code-snippets/insertMany.go
360+
:language: go
361+
:dedent:
362+
363+
.. output::
364+
:language: none
365+
:visible: false
366+
367+
2 documents inserted with IDs:
368+
ObjectID("...")
369+
ObjectID("...")
332370

333371
.. tab:: bson.D
334372
:tabid: bsonDExample
335373

336374
The following code uses a ``bson.D`` type to insert multiple new documents into the
337375
``restaurants`` collection:
338376

339-
.. literalinclude:: /includes/usage-examples/code-snippets/insertManyBsonD.go
340-
:language: go
341-
:dedent:
377+
.. io-code-block::
378+
:copyable: true
379+
380+
.. input::
381+
:language: go
382+
383+
.. literalinclude:: /includes/usage-examples/code-snippets/insertManyBsonD.go
384+
:language: go
385+
:dedent:
386+
387+
.. output::
388+
:language: none
389+
:visible: false
390+
391+
2 documents inserted with IDs:
392+
ObjectID("...")
393+
ObjectID("...")
342394

343395
Additional Information
344396
----------------------

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,4 @@ func main() {
6262
fmt.Printf("\t%s\n", id)
6363
}
6464

65-
// When you run this file, the expected output is similar to:
66-
// 2 documents inserted with IDs: ObjectID("..."), ObjectID("...")
6765
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,4 @@ func main() {
5959
fmt.Printf("\t%s\n", id)
6060
}
6161

62-
// When you run this file, the expected output is similar to:
63-
// 2 documents inserted with IDs: ObjectID("..."), ObjectID("...")
6462
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,4 @@ func main() {
5454
// Prints the ID of the inserted document
5555
fmt.Printf("Document inserted with ID: %s\n", result.InsertedID)
5656

57-
// When you run this file, the expected output is similar to:
58-
// Document inserted with ID: ObjectID("...")
5957
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,4 @@ func main() {
4848
// Prints the ID of the inserted document
4949
fmt.Printf("Document inserted with ID: %s\n", result.InsertedID)
5050

51-
// When you run this file, the expected output is similar to:
52-
// Document inserted with ID: ObjectID("...")
5351
}

0 commit comments

Comments
 (0)