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

Mongodb Bulk operation support #1613

Open
sourav11b opened this issue Oct 7, 2023 · 4 comments
Open

Mongodb Bulk operation support #1613

sourav11b opened this issue Oct 7, 2023 · 4 comments

Comments

@sourav11b
Copy link

nosqlbench mongodb driver should be able to support bulk operation https://www.mongodb.com/docs/manual/reference/method/js-bulk/

Yes, many application require order and unordered bulk operations with a mix of insert, updates and deletes

*yes. i can push code

Additional context

@sourav11b sourav11b changed the title Bulk operation support Mongodb Bulk operation support Oct 7, 2023
@msmygit
Copy link
Contributor

msmygit commented Oct 12, 2023

Hi @sourav11b 👋🏼

We have implemented the generic runCommand style support with the MongoDB Adaptor and hence you could already run bulk operations such as the following example in your workload as follows:

db.runCommand({
  bulkWrite: "<collection>",
  requests: [
    { insertOne: { document: { name: "John Doe", age: 25 } } },
    { updateOne: { filter: { name: "Jane Doe" }, update: { $inc: { age: 1 } } } },
    { deleteOne: { filter: { name: "Jim Doe" } } }
  ]
})

and in your workload, you could something such as below,

{
  bulkWrite: "<collection>",
  requests: [
    { insertOne: { document: { name: "John Doe", age: 25 } } },
    { updateOne: { filter: { name: "Jane Doe" }, update: { $inc: { age: 1 } } } },
    { deleteOne: { filter: { name: "Jim Doe" } } }
  ]
}

@sourav11b
Copy link
Author

bulkWrite is not working with runCommand

rs0 [direct: primary] test> use test_batch
switched to db test_batch
rs0 [direct: primary] test_batch> db.runCommand({
...   : "test_bulk",
...   requests: [
...     { insertOne: { document: { name: "John Doe", age: 25 } } },
...     { updateOne: { filter: { name: "Jane Doe" }, update: { $inc: { age: 1 } } } },
...     { deleteOne: { filter: { name: "Jim Doe" } } }
...   ]
... })
MongoServerError: Unknown admin command bulkWrite

@sourav11b
Copy link
Author

this the mongodb documentation for supported commands

https://www.mongodb.com/docs/manual/reference/command/#std-label-database-commands

@jshook
Copy link
Contributor

jshook commented Oct 18, 2023

The MongoDB drivers have changed significantly since we first introduced this adapter. Specifically, the underlying wire-protocol and BSON types have been effectively removed from circulation as they originally were documented. We'll likely be adding driver updates here to fit the current driver standards before adding any more features.
The original driver adapter did leave room for this with little effort. I believe only the common usage patterns and builders need to be added for the op types, mapper, and dispensers.

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

No branches or pull requests

3 participants