Skip to content

NODE-2724/types-against-driver #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2020
Merged

Conversation

reggi
Copy link
Contributor

@reggi reggi commented Sep 16, 2020

NODE-2724

When comparing the newly exported types from BSON with the community types @types/bson, check for inconsistencies within the driver usage.

> [email protected] build:ts /Users/thomasreggi/Desktop/git/mongodb/node-mongodb-native
> rimraf lib && tsc

src/bson.ts:32:15 - error TS2305: Module '"../node_modules/@types/bson"' has no exported member 'SerializeOptions'.

32 import type { SerializeOptions } from 'bson';
                 ~~~~~~~~~~~~~~~~

src/bulk/common.ts:604:18 - error TS2339: Property 'checkKeys' does not exist on type '{ ordered: boolean; } & BulkWriteOptions'.

604     finalOptions.checkKeys = false;
                     ~~~~~~~~~

src/bulk/common.ts:997:33 - error TS2339: Property 'checkKeys' does not exist on type 'BulkWriteOptions'.

997       checkKeys: typeof options.checkKeys === 'boolean' ? options.checkKeys : true
                                    ~~~~~~~~~

src/bulk/common.ts:997:67 - error TS2339: Property 'checkKeys' does not exist on type 'BulkWriteOptions'.

997       checkKeys: typeof options.checkKeys === 'boolean' ? options.checkKeys : true
                                                                      ~~~~~~~~~

src/cmap/wire_protocol/command.ts:105:51 - error TS2345: Argument of type 'Timestamp' is not assignable to parameter of type 'string | number | Long'.
  Type 'Timestamp' is not assignable to type 'Long'.
    Types of property '_bsontype' are incompatible.
      Type '"Timestamp"' is not assignable to type '"Long"'.

105       session.clusterTime.clusterTime.greaterThan(clusterTime.clusterTime)
                                                      ~~~~~~~~~~~~~~~~~~~~~~~

src/operations/find_and_modify.ts:113:13 - error TS2339: Property 'checkKeys' does not exist on type 'FindAndModifyOptions'.

113     options.checkKeys = false;
                ~~~~~~~~~

src/sdam/common.ts:75:46 - error TS2345: Argument of type 'Timestamp' is not assignable to parameter of type 'string | number | Long'.
  Type 'Timestamp' is not assignable to type 'Long'.

75     if ($clusterTime.clusterTime.greaterThan(topology.clusterTime.clusterTime)) {
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/sessions.ts:175:35 - error TS2345: Argument of type 'Timestamp' is not assignable to parameter of type 'string | number | Long'.
  Type 'Timestamp' is not assignable to type 'Long'.

175     if (operationTime.greaterThan(this.operationTime)) {
                                      ~~~~~~~~~~~~~~~~~~

src/sessions.ts:194:30 - error TS2339: Property 'equals' does not exist on type 'BinarySequence'.
  Property 'equals' does not exist on type 'number[]'.

194     return this.id.id.buffer.equals(session.id.id.buffer);
                                 ~~~~~~


Found 9 errors.

This PR aims to fix 8 of the 9 issues, the 9th issue should be fixed by the buffer resolution PR.

@reggi reggi marked this pull request as ready for review September 16, 2020 16:46
@mbroadst
Copy link
Member

@reggi please give us more details in your PR descriptions, it might not be obvious to others what your intent/methodology is

@reggi reggi requested a review from nbbeeken September 17, 2020 17:20
@reggi reggi merged commit c18ba71 into master Sep 18, 2020
@reggi reggi deleted the NODE-2724/types-against-driver branch September 18, 2020 14:39
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