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

Investigate NODE-3729 - Return types of find operations to not include the _id field

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • 1
    • Not Needed

      NODE-3729 Description

      What problem are you facing?

      When using operations like find, findOne or next, the return type is often TSchema which is either the default empty Document type, or the type we set for the collection using collection<Type>(). This is misleading as the return document also includes the _id field, which should be reflected in the type.

      What driver and relevant dependency versions are you using?

      node.js driver 4.1.3

      npm v8.0.0

      Node.js v16.13.0

      Steps to reproduce?

      Define a collection using db.collection<YourCustomType>("name")

      Use a find method like findOne on the collection: collection.findOne({foo: "bar"})

      Observe how the return type is equal to YourCustomType and does not include _id

            Assignee:
            daria.pardue@mongodb.com Daria Pardue
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: