Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Charts
Created by Guest
Created on Sep 27, 2020

Array of mixed types not working correctly

When we have an array of type [String, number], the second item is considered as string and hence, not able to do aggregation like sum. For example, consider ``` $project: { transposed: { $zip: { inputs: [["aaa","bbb"], [1, 2]] } } } I am not able to create a data table with transformed.0 in col1 and max(transformed.1) in col2
  • Guest
    Oct 6, 2020
    You should be able to use the Convert Type option to convert the array to numbers. Any non-numeric values will be converted to null, and the numeric accumulates should work.