Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions etc/notes/CHANGES_5.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ for await (const doc of cursor) {

cursor.closed // true
```

### Driver now sends `1` instead of `true` for hello commands

Everywhere the driver sends a `hello` command (initial handshake and monitoring), it will now pass the command value as `1` instead of the
previous `true` for spec compliance.
2 changes: 1 addition & 1 deletion src/cmap/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export function prepareHandshakeDocument(
const { serverApi } = authContext.connection;

const handshakeDoc: HandshakeDocument = {
[serverApi?.version ? 'hello' : LEGACY_HELLO_COMMAND]: true,
[serverApi?.version ? 'hello' : LEGACY_HELLO_COMMAND]: 1,
helloOk: true,
client: options.metadata || makeClientMetadata(options),
compression: compressors
Expand Down
2 changes: 1 addition & 1 deletion src/sdam/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function checkServer(monitor: Monitor, callback: Callback<Document | null>) {
const isAwaitable = topologyVersion != null;

const cmd = {
[serverApi?.version || helloOk ? 'hello' : LEGACY_HELLO_COMMAND]: true,
[serverApi?.version || helloOk ? 'hello' : LEGACY_HELLO_COMMAND]: 1,
...(isAwaitable && topologyVersion
? { maxAwaitTimeMS, topologyVersion: makeTopologyVersion(topologyVersion) }
: {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Handshake', function () {
// Execute legacy hello command
client
.db(configuration.db)
.command({ [LEGACY_HELLO_COMMAND]: true })
.command({ [LEGACY_HELLO_COMMAND]: 1 })
.then(function (result) {
test.ok(result !== null);

Expand Down
4 changes: 2 additions & 2 deletions test/unit/sdam/monitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ describe('monitoring', function () {
const doc = request.document;
docs.push(doc);
if (docs.length === 2) {
expect(docs[0]).to.have.property(LEGACY_HELLO_COMMAND, true);
expect(docs[0]).to.have.property(LEGACY_HELLO_COMMAND, 1);
expect(docs[0]).to.have.property('helloOk', true);
expect(docs[1]).to.have.property('hello', true);
expect(docs[1]).to.have.property('hello', 1);
done();
} else if (isHello(doc)) {
setTimeout(() => request.reply(Object.assign({ helloOk: true }, mock.HELLO)), 250);
Expand Down