You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide.md
+37-8Lines changed: 37 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -109,9 +109,7 @@ const schema = new Schema();
109
109
schema.path('_id'); // ObjectId { ... }
110
110
```
111
111
112
-
When you create a new document with the automatically added
113
-
`_id` property, Mongoose creates a new [`_id` of type ObjectId](https://masteringjs.io/tutorials/mongoose/objectid)
114
-
to your document.
112
+
When you create a new document with the automatically added `_id` property, Mongoose creates a new [`_id` of type ObjectId](https://masteringjs.io/tutorials/mongoose/objectid) to your document.
115
113
116
114
```javascript
117
115
constModel=mongoose.model('Test', schema);
@@ -120,13 +118,13 @@ const doc = new Model();
120
118
doc._idinstanceofmongoose.Types.ObjectId; // true
121
119
```
122
120
123
-
You can also overwrite Mongoose's default `_id` with your
124
-
own `_id`. Just be careful: Mongoose will refuse to save a
125
-
document that doesn't have an `_id`, so you're responsible
126
-
for setting `_id` if you define your own `_id` path.
121
+
You can also overwrite Mongoose's default `_id` with your own `_id`.
122
+
Just be careful: Mongoose will refuse to save a top-level document that doesn't have an `_id`, so you're responsible for setting `_id` if you define your own `_id` path.
0 commit comments