Skip to content

Commit c07b179

Browse files
authored
Merge pull request #2733 from lourendotco/patch-1
remove() has been deprecated
2 parents 8846945 + d7e029d commit c07b179

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/content/4/en/part4b.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ By [chaining promises](https://javascript.info/promise-chaining) we could keep t
418418
```js
419419
Note.find({})
420420
.then(notes => {
421-
return notes[0].remove()
421+
return notes[0].deleteOne()
422422
})
423423
.then(response => {
424424
console.log('the first note is removed')
@@ -444,7 +444,7 @@ The slightly complicated example presented above could be implemented by using a
444444

445445
```js
446446
const notes = await Note.find({})
447-
const response = await notes[0].remove()
447+
const response = await notes[0].deleteOne()
448448

449449
console.log('the first note is removed')
450450
```
@@ -462,7 +462,7 @@ const main = async () => { // highlight-line
462462
const notes = await Note.find({})
463463
console.log('operation returned the following notes', notes)
464464

465-
const response = await notes[0].remove()
465+
const response = await notes[0].deleteOne()
466466
console.log('the first note is removed')
467467
}
468468

@@ -581,7 +581,7 @@ const initialNotes = [
581581
const nonExistingId = async () => {
582582
const note = new Note({ content: 'willremovethissoon' })
583583
await note.save()
584-
await note.remove()
584+
await note.deleteOne()
585585

586586
return note._id.toString()
587587
}

0 commit comments

Comments
 (0)