[SERVER-68108] $densify with dynamic bounds array causes "A bounding array must contain either both dates or both numeric types" error Created: 18/Jul/22 Updated: 27/Oct/23 Resolved: 05/Aug/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 6.0.0-rc13 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Daniel Cooke | Assignee: | Sam Mercier |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Sprint: | QO 2022-08-08 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
I am trying to add missing data to my time series with the `$densify` operator. But it does not seem to work when I specify any dynamic values in the bounds array. *Example* So with the following `$densify` operator I would expect it to work properly: ] But I get the following error: `A bounding array must contain either both dates or both numeric types` Which does not make sense, because `{ $week: "$$CLUSTER_TIME" }` evalutes to a number, and 0 is definetly a number last I checked. Sounds like a bug with mongo to me, anyone know? |
| Comments |
| Comment by Chris Kelly [ 05/Aug/22 ] | |||||||
|
Hi Daniel, Use of expressions in $densify is not currently supported by design. I'll suggest a note to be added to the docs to reflect this since it's came up a few times recently. However, it may be worth posting this to feedback.mongodb.com if you are interested in this feature. Thanks for your report!
| |||||||
| Comment by Daniel Cooke [ 21/Jul/22 ] | |||||||
|
I saw another issue relating to the inability to use expressions in the densify bounds, could this be the real issue ? | |||||||
| Comment by Chris Kelly [ 20/Jul/22 ] | |||||||
|
Hi Daniel, Thanks for your report. I can see how you'd expect this to work. My original hypothesis was that $$CLUSTER_TIME is stored differently internally as BSONType::bsonTimestamp, which is somehow being interpreted differently than numeric value 0. I noticed your reported behavior with $$NOW as well, which I believe is BSONType::Date. However, doing a $toInt or $toDate on any values in $densify will also produce this error, including:
Which also reports "A bounding array must contain either both dates or both numeric types" Regards, | |||||||
| Comment by Daniel Cooke [ 18/Jul/22 ] | |||||||
|
I copied this issue from my StackOverflow textbox, so the formatting is all off - apologies |