Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-16350

[SERVER] Error with $hour result in an example

    XMLWordPrintableJSON

Details

    • 1

    Description

      In one of the example for $hour (aggregation) documentation, the result is 18.

      { $hour: {
          date: new Date("August 14, 2011Z"),
          timezone: "America/Chicago"
      } }
      

      However the correct result should be 19. Running in the same in old (legacy) mongo shell gives 18. This is because that syntax is wrong for mongosh and the date becomes ISODate("1970-01-01T00:00:00Z")

       

      Discussion on Slack: https://mongodb.slack.com/archives/CC1SW4PA4/p1693242762226949

      Attachments

        Activity

          People

            lauren.tran@mongodb.com Lauren Tran
            yan-cheng.phuah@mongodb.com YC Phuah
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              23 weeks, 1 day ago