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

Docs for SERVER-30524: dateFromParts expects "milliseconds" instead of "millisecond"

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.12
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Documentation Request Summary:

      This changes the input argument "milliseconds" to "millisecond" that was introduced in 3.5.11 as a typo.

      Engineering Ticket Description:

      db.foo.aggregate({$project:{milli:{$millisecond:"$date"}}})
      { "_id" : ObjectId("5984bd888a8d0117a3bbb81d"), "milli" : 0 }
      { "_id" : ObjectId("5984bd888a8d0117a3bbb81e"), "milli" : 374 }
      

      but

      db.foo.aggregate({$project:{date:{$dateFromParts:{millisecond:318,year:1970}}}})
      assert: command failed: {
      	"ok" : 0,
      	"errmsg" : "Unrecognized argument to $dateFromParts: millisecond",
      	"code" : 40518,
      	"codeName" : "Location40518"
      } : aggregate failed
      // but 
      db.foo.aggregate({$project:{date:{$dateFromParts:{milliseconds:318,year:1970}}}})
      { "_id" : ObjectId("5984bd888a8d0117a3bbb81b"), "date" : ISODate("1970-01-01T00:00:00.318Z") }
      

      And $dateToParts returns: "year" : 1975, "month" : 6, "day" : 12, "hour" : 0, "minute" : 0, "second" : 0, "millisecond" : 0

      So I think this milliseconds is a typo.

            Assignee:
            jeffrey.allen@mongodb.com Jeffrey Allen
            Reporter:
            emily.hall Emily Hall
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              6 years, 32 weeks ago