Bulk-insert multiple documents into MongoDB with KNIME
Hello KNIME community,
I’m trying to bulk-insert rows from a KNIME data table into a MongoDB collection. Right now I’m converting each row to JSON and using the MongoDB Writer node to insert one document at a time—but that ends up taking forever on large tables.
What I’ve tried so far
Convert each row to JSON
Used Columns To JSON to generate one JSON string per row.
Fed each into the MongoDB Update node.
Result: Works, but painfully slow.
deleteMany example
To delete multiple documents in one go I used a filter like:
{
"_id": {
"$in": [
{ "$oid": "6815fd39614ee74f14617b8a" },
{ "$oid": "6815fd39614ee74f14617b7b" }
]
}
}That correctly deletes all matched IDs.
What I’m looking for
insertMany (bulk insert) in a single call, not row-by-row.
The correct JSON structure (or wrapper) that KNIME’s MongoDB nodes expect for `insertMany`.
Example of desired payload
Here’s the JSON array I’d love to send in one shot:
[
{ "bnm": "A", "verd": "P", "exDate": "2025-02-27T17:31:54"},
{ "bnm": "B", "verd": "P", "exDate": "2025-02-27T17:31:54" },
{ "bnm": "A", "verd": "F", "exDate": "2025-02-27T17:31:54" }
]I’ve also tried wrapping it like:
{
"documents": [
{ "bnm": "A", "verd": "P", "exDate": "2025-02-27T17:31:54"},
{ "bnm": "B", "verd": "F", "exDate": "2025-02-27T17:31:54"}
]
}…but neither approach seems to work in the Update node.
Questions:
What’s the correct JSON format to perform an `insertMany` in KNIME’s MongoDB nodes?
Are there any KNIME best practices or example workflows for bulk-inserting large numbers of documents at once?
Thanks in advance for any guidance or example workflows you can share!