Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

[Feature request] increase performances using bulk write #123

Closed
claustres opened this issue Sep 27, 2018 · 5 comments · Fixed by #131
Closed

[Feature request] increase performances using bulk write #123

claustres opened this issue Sep 27, 2018 · 5 comments · Fixed by #131

Comments

@claustres
Copy link
Contributor

When inserting, updating or deleting multiple documents at once I think the recommended and optimal way is to use http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#bulkWrite.

It can also helps implementing patching of multiple objects using different filter queries at the same time.

So I wonder if you think it is worth considering using it to standardize the underlying interface ?

It might also help to solve #122.

@daffl
Copy link
Member

daffl commented Nov 15, 2018

I believe this has also been addressed via #126

@Gerigot
Copy link
Contributor

Gerigot commented Nov 15, 2018

I haven't used bulk write in my fix so I will check if there are performance differences between that and insertMany/updateMany.

In case I'll make another PR.

@claustres
Copy link
Contributor Author

I think this is already a great work you did, I don't think that there will be a lot of differences.

What could be interesting is that it can also helps implementing patching of multiple objects using different filter queries at the same time.

@Gerigot
Copy link
Contributor

Gerigot commented Nov 15, 2018

Can you make some examples, or at least one example, of what you mean? so if it's useful and I can I will work on that.

@claustres
Copy link
Contributor Author

You can make multiple updateOne/updateMany operations, each with a different filter: https://docs.mongodb.com/manual/reference/method/db.collection.bulkWrite/#updateone-and-updatemany.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants