How to break an array to columns

Hi All,
This is similar to my earlier question. I installed metabase and was playing with native query to unwind my array. The query works but the tabular view is like below,
image

I want to display them such that index 0 is column 1 and index 1 is column 2. This is my query,

[
  {"$limit": 5},
  {
    "$project": {
      "modified": {
        "$zip": {
          "inputs": ["$a", "$b"]
        }
      }
    }
  }
]

Nevermind, I figured it out. I used the below query,

[
  {"$limit": 5},
  {
    "$project": {
      "modified": {
        "$zip": {
          "inputs": ["$a", "$b"]
        }
      }
    }
  },
  {
      "$unwind": {
          "path": "$modified"
      }
  },
  {
      "$project": {
            "name": 1,
            "col1": { 
                "$arrayElemAt": [ "$modified", 0 ]
            },
            "col2": { 
                "$arrayElemAt": [ "$modified", -1 ]
            }
      }
  }
1 Like