Skip to content

Commit 236a7a7

Browse files
authored
Merge pull request #13976 from danielcoker/patch-1
Fix Typo In Timestamps Docs
2 parents 8cbb224 + 77bd781 commit 236a7a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/timestamps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Mongoose: users.findOneAndUpdate({}, { '$setOnInsert': { createdAt: new Date("Su
199199

200200
Notice the `$setOnInsert` for `createdAt` and `$set` for `updatedAt`.
201201
MongoDB's [`$setOnInsert` operator](https://www.mongodb.com/docs/manual/reference/operator/update/setOnInsert/) applies the update only if a new document is [upserted](https://masteringjs.io/tutorials/mongoose/upsert).
202-
So, for example, if you want to *only* set `updatedAt` if the document if a new document is created, you can disable the `updatedAt` timestamp and set it yourself as shown below:
202+
So, for example, if you want to *only* set `updatedAt` if a new document is created, you can disable the `updatedAt` timestamp and set it yourself as shown below:
203203

204204
```javascript
205205
await User.findOneAndUpdate({}, { $setOnInsert: { updatedAt: new Date() } }, {

0 commit comments

Comments
 (0)