[SERVER-56249] $derivative should error when sortBy is unexpected type Created: 21/Apr/21  Updated: 29/Oct/23  Resolved: 05/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Improvement Priority: Major - P3
Reporter: David Percy Assignee: David Percy
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Documented
Backwards Compatibility: Minor Change
Sprint: Query Optimization 2021-05-03, Query Optimization 2021-05-17
Participants:

 Description   

When the sortBy field is a date, $derivative requires an outputUnit so it can convert a 1/time quantity to a unitless value. Conversely, when the sortBy field is unitless, $derivative requires outputUnit to be omitted.

In both cases, we should throw an error instead of returning null. That should make it clearer how to fix a query where the presence/absence of 'outputUnit' doesn't match the data.



 Comments   
Comment by Githook User [ 05/May/21 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-56249 $derivative throws an error when sortBy value is an unexpected type
Branch: master
https://github.com/mongodb/mongo/commit/4e0fb93fa5bd99e030addf8bb3707f1cbd012980

Generated at Thu Feb 08 05:38:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.