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

Typescript complains that $currentDate is used with type boolean instead of type 'Date | Timestamp'

    • 3
    • Not Needed
    • None
    • Hide

      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.

      Show
      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      What problem are you facing?

      Typescript complains when using $currentDate with findOneAndUpdate.

       

       

      Hovering _update gives the following error.

       

      And here is the type declaration

       

       

      MongoDB v.4.4 documentation supports boolean for $currentDate while other references mention that it it not supported anymore:

      https://docs.mongodb.com/v4.4/reference/operator/update/currentDate/

      https://github.com/mongodb/docs/commit/55057e64f8c8112be35560ee8d6e603baec414a3

       

      The Node.js Driver v.4.1 support also boolean

      https://mongodb.github.io/node-mongodb-native/4.1/modules.html#UpdateFilter

       

      What driver and relevant dependency versions are you using?

      • MongoDB: v4.4.0
        Typescript: 4.2.3
        Mongodb Node.js Driver: 4.1.3

        1. image-2021-10-19-01-28-27-555.png
          image-2021-10-19-01-28-27-555.png
          65 kB
        2. image-2021-10-19-01-30-32-434.png
          image-2021-10-19-01-30-32-434.png
          66 kB
        3. image-2021-10-19-01-31-16-866.png
          image-2021-10-19-01-31-16-866.png
          145 kB

            Assignee:
            aditi.khare@mongodb.com Aditi Khare (Inactive)
            Reporter:
            elias.lanvin@truedigital.com Elias A.K. Lanvin
            Bailey Pearson
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None