Documentation not updated- 'Model.insertMany() no longer accepts a callback'); #13616
Closed
2 tasks done
Labels
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone
Prerequisites
Mongoose version
7.3.4
Node.js version
18.16.1
MongoDB server version
4.0.28
Typescript version (if applicable)
No response
Description
I have followed the mongoose documentation to use Model.insertMany() in my code.
The documentation example states to use the following:
Considering the documentation, I used the following code for my project:
The above code produces the following error:
With stackoverflow, I was able to understand that the callback function with insertMany() method has been deprecated. Hence, I refactored my code following the SO suggestions as below:
The above code seems to solve the issue for me.
I believe the documentation needs to be updated in here.
I am also willing to work and contribute in this issue.
Steps to Reproduce
Running the following code in the terminal with the command "node app.js" reproduces the error.
Expected Behavior
I wanted the code to successfully insert the documents in the collection, but it produces the error "MongooseError('Model.insertMany() no longer accepts a callback')"
The text was updated successfully, but these errors were encountered: