Skip to content

Conversation

@blink1073
Copy link

@blink1073 blink1073 commented Dec 9, 2025

Description

  • Fix handling of keyFile: read/write cannot occur until user is added, and can never be done on an arbiter
  • Add support for requireApiVersion, which must be applied after the cluster has started and update the default connection options.
  • Allow args to be passed as part of the config file.
  • Only write the connection string to stdout, so it can be captured by the calling process

Tested with:

We didn't need to add extra support for unix sockets, instead we pass in the unix socket prefix.
I couldn't think of an elegant way to let mongodb-runner manage the keyFile, perhaps a new top level argument keyFileContent?

Open Questions

Checklist

@blink1073 blink1073 requested a review from addaleax December 9, 2025 13:18
@coveralls
Copy link

coveralls commented Dec 9, 2025

Coverage Status

coverage: 77.691% (-0.3%) from 77.955%
when pulling 56a3abd on blink1073:drivers-tools-followup
into 80530af on mongodb-js:main.

@addaleax addaleax changed the title DRIVERS-3335 Usability improvements for drivers feat(mongodb-runner): usability improvements for drivers DRIVERS-3335 Dec 9, 2025
await cluster.updateDefaultConnectionOptions({
serverApi: String(options.requireApiVersion) as '1',
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest putting this in a separate method, like we did for addAuthIfNeeded()

if (buildInfoError) {
debug('failed to get buildInfo', buildInfoError);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If a keyfile is being used, wouldn't we want to use it for authentication?

Copy link
Author

Choose a reason for hiding this comment

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

No, when a keyFile is present you can't do anything on the server until a user has been added to the primary.

return true;
}
// If the server does not support auth, just get the build info without
// setting the metadata.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Which scenario is this intended to cover? buildInfo is behind auth on newer server versions

Copy link
Author

Choose a reason for hiding this comment

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

It covers arbiters after authentication has been added to the replica set (their behavior is a bit weird), I'll update the comment.

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.

3 participants