Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

gagik
Copy link
Contributor

@gagik gagik commented Mar 25, 2025

New bulkWrite(...) command for Mongo instances.

As stated for the driver, this API is meant to replace the existing bulk write API on the Collection as it supports a bulk write across multiple databases and collections in a single call.
The command uses the active mongosh client and replicates the API from the driver in form of

Mongo().bulkWrite([{
  namespace: string | Collection /** '<db>.<collection>' */,
  name: <operation>,
		  /* Other operation-specific props */
}, ...]);

addaleax
addaleax previously approved these changes Mar 25, 2025
bulkWrite(
models: AnyClientBulkWriteModel<Document>[],
options: ClientBulkWriteOptions = {}
): Promise<ClientBulkWriteResult> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've typically wrapped result types in our own types so that we're a bit more independent when it comes to server changes, see result.ts – I'd consider doing that here as well if we can (this mostly already matches our existing BulkWriteResult as well?)

import type { LogEntry } from './log-entry';
import { parseAnyLogEntry } from './log-entry';
import type { ShellBson } from './shell-bson';
import type { ClientBulkWriteOptions } from 'mongodb';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No imports from mongodb in shell-api, the dependency on that package is only for use in the integration tests of shell-api

If you need driver types, they should be exported from service-provider-core. The fact that we're just re-exporting the driver types there is honestly not great, but it's just pretty practical for now

@addaleax addaleax dismissed their stale review March 25, 2025 14:21

didn't mean to approve, sorry

@gagik gagik force-pushed the gagik/bulk-write branch 2 times, most recently from 7376071 to cd63fab Compare March 26, 2025 10:37
Copy link
Collaborator

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! :shipit:

@gagik gagik force-pushed the gagik/bulk-write branch from cd63fab to bf1396d Compare March 27, 2025 10:53
@gagik gagik merged commit 0f734ed into main Mar 27, 2025
12 of 13 checks passed
@gagik gagik deleted the gagik/bulk-write branch March 27, 2025 10:53
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

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.