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

bulkWrite operation is missing #16

Open
mishaniy opened this issue Mar 31, 2018 · 2 comments
Open

bulkWrite operation is missing #16

mishaniy opened this issue Mar 31, 2018 · 2 comments

Comments

@mishaniy
Copy link

db.collection.bulkWrite()
https://docs.mongodb.com/manual/reference/method/db.collection.bulkWrite/

@ghmeier
Copy link
Member

ghmeier commented Oct 11, 2019

Thanks for the request! I'm curious to hear your use case for this outside of mongoist's existing bulk operation support and would be open to a PR implementing this operation.

@SamDecrock
Copy link

SamDecrock commented Jul 14, 2021

In case you want to upsert many documents, you can do the following with those bulk operations:

var bulk = db.collection.initializeOrderedBulkOp()
for(var doc of docs) bulk.find( { _id: doc._id } ).upsert().updateOne(doc); // or use replaceOne()
await bulk.execute();

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

3 participants