Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to use InsertMany when creating array of objects #427

Open
RuneSP opened this issue Apr 15, 2021 · 1 comment
Open

Option to use InsertMany when creating array of objects #427

RuneSP opened this issue Apr 15, 2021 · 1 comment

Comments

@RuneSP
Copy link

RuneSP commented Apr 15, 2021

Looking through the code, it seems the standard mongoose create method is also used when passing an array of objects.

Would it be possible to add an option to use InsertMany instead when passing an array of objects? InsertMany is faster as it will only send one operation to database instead of one for each document.

https://mongoosejs.com/docs/api/model.html#model_Model.insertMany

Thanks,
Rune

@Zertz
Copy link
Collaborator

Zertz commented Oct 24, 2022

As far as I can remember, the only reason we don't use insertMany is that it didn't exist back then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants