Help Transforming Data

I have data in the following shape (sample of just two documents show, many more in collection):

{
    "_id" : ObjectId("6157777910c43dbcfc976804"),
    "type" : "channels",
    "data" : [ 
        {
            "id" : 1,
            "channel" : "Webform",
            "sortorder" : 10
        }, 
        {
            "id" : 2,
            "channel" : "Chat",
            "sortorder" : 20
        }, 
        {
            "id" : 3,
            "channel" : "Email",
            "sortorder" : 30
        }, 
        {
            "id" : 4,
            "channel" : "Phone",
            "sortorder" : 40
        }, 
        {
            "id" : 5,
            "channel" : "Walk-in",
            "sortorder" : 50
        }, 
        {
            "id" : 6,
            "channel" : "Social Media",
            "sortorder" : 60
        }
    ]
}

{
    "_id" : ObjectId("6157781310c43dbcfc97e74f"),
    "type" : "companytypes",
    "data" : [ 
        {
            "id" : 1,
            "companytype" : "Individual",
            "sortorder" : 10
        }, 
        {
            "id" : 2,
            "companytype" : "Sole Proprietorship",
            "sortorder" : 20
        }, 
        {
            "id" : 3,
            "companytype" : "Partnership",
            "sortorder" : 30
        }, 
        {
            "id" : 4,
            "companytype" : "Corporation/Incorporated",
            "sortorder" : 40
        }, 
        {
            "id" : 5,
            "companytype" : "Limited (Ltd)",
            "sortorder" : 50
        }, 
        {
            "id" : 6,
            "companytype" : "Limited Liability (LLC)",
            "sortorder" : 60
        }, 
        {
            "id" : 7,
            "companytype" : "Joint Venture",
            "sortorder" : 70
        }, 
        {
            "id" : 8,
            "companytype" : "Other",
            "sortorder" : 80
        }
    ]
}

I want to return data in the following shape:

{
  "type": "channels",
  "data": [
    {"channel": "Webform"},
    {"channel": "Chat"},
    {"channel": "Email"},
    {"channel": "Phone"},
    {"channel": "Walk-in"},
    {"channel": "Social Media"}
  ]
}

{
  "type": "companytypes",
  "data": [
    {"companytype": "Individual"},
    {"companytype": "Sole Proprietorship"},
    {"companytype": "Partnership"},
    {"companytype": "Corporation/Incorporated"},
    {"companytype": "Limited (Ltd)"},
    {"companytype": "Limited Liability (LLC)"},
    {"companytype": "Joint Venture"},
    {"companytype": "Other"}
  ]
}

I’m pretty sure I can do this with a Transform, but I’m not sure how. I’m just starting work on my first real MongoDB project

This worked for me as a quick first cut… I think it could use some optimization

     [
      {
        '$match': {
          'type': 'channels'
        }
      }, {
        '$unwind': {
          'path': '$data', 
          'includeArrayIndex': 'string', 
          'preserveNullAndEmptyArrays': false
        }
      }, {
        '$project': {
          'channel': '$data.channel', 
          '_id': 0
        }
      }, {
        '$group': {
          '_id': null, 
          'channels': {
            '$push': '$channel'
          }
        }
      }, {
        '$project': {
          'channels': 1, 
          '_id': 0
        }
      }
    ]