Skip to content

Commit

Permalink
add check to remove wordiness
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed Sep 12, 2024
1 parent 8243f99 commit 7c607fd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/cmap/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export class OpQueryRequest {
awaitData: boolean;
exhaust: boolean;
partial: boolean;
/** moreToCome is an OP_MSG only concept */
moreToCome = false;

constructor(
public databaseName: string,
Expand Down
4 changes: 2 additions & 2 deletions src/cmap/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
zlibCompressionLevel: this.description.zlibCompressionLevel
});

if (options.noResponse || ('moreToCome' in message && message.moreToCome)) {
if (options.noResponse || message.moreToCome) {
yield MongoDBResponse.empty;
return;
}
Expand Down Expand Up @@ -529,7 +529,7 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
message,
options.noResponse
? undefined
: 'moreToCome' in message && message.moreToCome
: message.moreToCome
? { ok: 1 }
: (object ??= document.toObject(bsonOptions)),
started,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/node-specific/mongo_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ describe('class MongoClient', function () {
expect(startedEvents).to.have.lengthOf(1);
expect(startedEvents[0]).to.have.property('commandName', 'endSessions');
expect(endEvents).to.have.lengthOf(1);
expect(endEvents[0]).to.have.property('reply', undefined); // noReponse: true
expect(endEvents[0]).to.containSubset({ reply: { ok: 1 } });
});

context('when server selection would return no servers', () => {
Expand Down
1 change: 1 addition & 0 deletions test/integration/read-write-concern/write_concern.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ describe('Write Concern', function () {

const listIndexesResult = col.listIndexes({ batchSize: 2 });
const err = await listIndexesResult.toArray().catch(e => e);

expect(err).to.not.be.instanceOf(Error);
});

Expand Down

0 comments on commit 7c607fd

Please sign in to comment.