Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4498

Test assignability of returned api results with OptionalId<Schema> to Schema with _id

    • 2
    • Not Needed
    • Not Needed

      Use Case

      As a... user of the Node.js driver
      I want... to be able to use my collection's read schema directly to type the returned documents of read and write operations such as findAndModify
      So that... I don't have to use awkward wrappers or rely strictly on the driver's type inference to get the correct type results

      User Impact

      • Ensures user defined types work as expected

      Dependencies

      • None

      Unknowns

      • Complete list of operations that returns a full document

      Acceptance Criteria

      • Add TS tests to make sure that the returned document in the result of each operation applied to a `Collection<OptionalId<SchemaWithId>>` is assignable to `SchemaWithId` (where `SchemaWithId` is a collection schema that has `_id: ObjectId`)
      • Enumerate any methods which currently do not support this
      • Try to see if there is a straightforward adjustment that can be made to our OptionalId or read operation result types to enable this use case
        • If not, discuss next steps with team, so that we can decide how we want to proceed for V5

      Implementation Requirements

      • see AC

      Testing Requirements

      • TS tests

      Documentation Requirements

      • N/A

      Follow Up Requirements

      • If the issue cannot be addressed, we'll need a follow up ticket, possibly design, for handling schemas in V5

            Assignee:
            daria.pardue@mongodb.com Daria Pardue
            Reporter:
            daria.pardue@mongodb.com Daria Pardue
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: