'mongodb: why rust mongodb driver does not support bulk write operation? are any workarounds?
I found discussion about the topic here https://jira.mongodb.org/browse/RUST-271 The latest answer:
Hello! We don't implement the bulk write API and have no plans to add it. From dealing with it in other drivers, we've found that the semantics tend to be non-obvious, especially with regards to error handling, and it doesn't provide a whole lot of technical benefit given that it still sends different write types in separate commands to the server (i.e. the same way as if each of insert_many, update_many, delete_many, etc. were called separately).
But there is something still not clear for me.
Why that answer mention *_many (update_many, insert_many etc) type operations if bulk write is set of *_one (update_one, insert_one etc)?
Ok, insert_many uses bulk write under the hood. But bulk write and update many are different. Because first one uses a set of update_one operations which have different filters and update bodies for each one. And update_many has one filter for many updates.
So, update_many cannot replace bulk write. Am I right? If so, then why MongoDB rust driver does not support bulk write? If I am not right can you please explain why? Maybe I do not understand some details.
It seems if I use update_one a lot of time I get bad performance compared to bulk write. Because in case of bulk write I will connect once to MongoDB compared to update_one where I need one connection per update_one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
