williamkapke / mongo-mock

Let's pretend we have a real MongoDB
MIT License
240 stars 75 forks source link

Add bulkWrite implementation #151

Closed conlanpatrek closed 2 years ago

conlanpatrek commented 2 years ago

Needed this, so wrote an implementation, hopefully it's helpful.

I'm forwarding each bulk write operation to the corresponding method, then aggregating the results.

As of opening this PR replaceOne is not implemented, but I see some open PRs for it. Once that method gets a body, replaceOne operations provided to a bulk write call should just start working.

LinusU commented 2 years ago

Sorry for not seeing this earlier, just a small comment!

conlanpatrek commented 2 years ago

Updated. Let me know if you want to see anything else in here. For example, the response object is pretty simplified atm, and the actual driver result gives you a lot more detail about your bulk operations.

Shahriar87 commented 2 years ago

Will the commit be released to a new version anytime soon?

angelo-hub commented 2 years ago

ack'd can look into doing a minor version push

LinusU commented 2 years ago

Sorry for not releasing this, generally I aim to always release versions after merging PRs! Will push at a release now 🐎

@angelo-hub since it only takes a minute do to and since you commented ~12h I'll just push out a release now, I hope that's okay, didn't mean to steal your work 😅

LinusU commented 2 years ago

Released as 4.2.0, and published to npm ✔️