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

Comment on: "manual/reference/operator/aggregation/dateToString.txt"

    XMLWordPrintableJSON

Details

    Description

      The description for %u is wrong:

      Day of week number in ISO 8601 format (1-Sunday, 7-Saturday)

      It should be:

      Day of week number in ISO 8601 format (1-Monday, 7-Sunday)

      > db.tz.insert( { d: new ISODate( "2017-02-06" ) } );
      WriteResult({ "nInserted" : 1 })
      > db.tz.aggregate( [ { $project: { 'w': { $dateToString : { format: '%w', date: '$d' }  }, 'u' : { $dateToString : { format: '%u', date: '$d' } } }}  ] );
      { "_id" : ObjectId("589b0961da41ef23b502910d"), "w" : "2", "u" : "1" }
      

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 25 weeks, 1 day ago