@@ -35,24 +35,24 @@ an ObjectId value to the new document. See
35
35
36
36
.. example::
37
37
38
- To insert a new document into the ``sample_mflix.movies`` collection:
38
+ To insert a new document into the ``sample_mflix.movies`` collection:
39
39
40
- .. code-block:: javascript
40
+ .. code-block:: javascript
41
41
42
- use sample_mflix
42
+ use sample_mflix
43
43
44
- db.movies.insertOne(
45
- {
46
- title: "The Favourite",
47
- genres: [ "Drama", History" ]
48
- runtime: 121,
49
- rated: "R",
50
- year: 2018,
51
- directors: [ "Yorgos Lanthimos" ],
52
- cast: [ "Olivia Colman", "Emma Stone", "Rachel Weisz" ],
53
- type: "movie"
54
- }
55
- )
44
+ db.movies.insertOne(
45
+ {
46
+ title: "The Favourite",
47
+ genres: [ "Drama", " History" ],
48
+ runtime: 121,
49
+ rated: "R",
50
+ year: 2018,
51
+ directors: [ "Yorgos Lanthimos" ],
52
+ cast: [ "Olivia Colman", "Emma Stone", "Rachel Weisz" ],
53
+ type: "movie"
54
+ }
55
+ )
56
56
57
57
:method:`~db.collection.insertOne()` returns a document that
58
58
includes the newly inserted document's ``_id`` field value.
@@ -64,10 +64,8 @@ an ObjectId value to the new document. See
64
64
65
65
db.inventory.find( { title: "The Favourite" } )
66
66
67
- .. note::
68
-
69
- To ensure you return the document you inserted, you can instead
70
- query by ``_id``.
67
+ To ensure you return the document you inserted, you can instead
68
+ query by ``_id``.
71
69
72
70
Insert Multiple Documents
73
71
-------------------------
0 commit comments