[SERVER-30524] dateFromParts expects "milliseconds" instead of "millisecond" Created: 04/Aug/17  Updated: 30/Oct/23  Resolved: 08/Aug/17

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 3.5.12

Type: Bug Priority: Major - P3
Reporter: Asya Kamsky Assignee: Derick Rethans
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-10652 Docs for SERVER-30524: dateFromParts ... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 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.



 Comments   
Comment by Githook User [ 08/Aug/17 ]

Author:

{'name': 'Derick Rethans', 'username': 'derickr', 'email': 'github@derickrethans.nl'}

Message: SERVER-30524 dateFromParts should expect "millisecond" instead of "milliseconds"
Branch: master
https://github.com/mongodb/mongo/commit/8962beb1b8f8ca869a9f7ccdc4a7eeab2b84c2f4

Comment by Derick Rethans [ 05/Aug/17 ]

https://mongodbcr.appspot.com/149560001/

Generated at Thu Feb 08 04:24:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.