title: Merge documents with its nested arrays and their nested arrays
body: <p>I'm trying to create a query with the aggregation framework, but I could not get the result I want.
  I have a collection of resellers, each reseller have a list of clients, each clients have a list of members, the structure is as below :</p>
  
  <pre><code>[
  {
    "userID" : "xxx",
    "userType" : "RESELLER",
    "clients" : [
       {
          "userID" : "xxx",
          "userType" : "CLIENT",
          "members" : [
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             },
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             }
          ]
       },
  {
          "userID" : "xxx",
          "userType" : "CLIENT",
          "members" : [
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             },
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             }
          ]
       }
     ]
  },
  {
    "userID" : "xxx",
    "userType" : "RESELLER",
    "clients" : [
       {
          "userID" : "xxx",
          "userType" : "CLIENT",
          "members" : [
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             },
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             }
          ]
       },
  {
          "userID" : "xxx",
          "userType" : "CLIENT",
          "members" : [
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             },
             {
                "userID" : "xxx",
                "userType" : "MEMBER"
             }
          ]
       }
     ]
  }
  ]
  </code></pre>
  
  <p>The result I want to get is :</p>
  
  <pre><code>[
     {
        "userID" : "xxx",
        "userType" : "RESELLER"
     },
     {
        "userID" : "xxx",
        "userType" : "RESELLER"
     },
     {
        "userID" : "xxx",
        "userType" : "CLIENT"
     },
     {
        "userID" : "xxx",
        "userType" : "CLIENT"
     },
     {
        "userID" : "xxx",
        "userType" : "CLIENT"
     },
     {
        "userID" : "xxx",
        "userType" : "CLIENT"
     },
     {
        "userID" : "xxx",
        "userType" : "MEMBER"
     },
     {
        "userID" : "xxx",
        "userType" : "MEMBER"
     },
     {
        "userID" : "xxx",
        "userType" : "MEMBER"
     },
     {
        "userID" : "xxx",
        "userType" : "MEMBER"
     },
     {
        "userID" : "xxx",
        "userType" : "MEMBER"
     }
  ]
  </code></pre>
  
  <p>I did so many try but I did not to get this result.
  The closest solution that I did is :</p>
  
  <pre><code>db.resellers.aggregate([
  {
      $unwind: "$clients"
  },
  {
      $project: {
          _id : 0,
          teamMembers : "$clients.members"
      }
  },
  {
      $unwind: "$members"
  },
  {
      $project: {
          _id : 0,
          userID : "$members.userID",
          type : "$members.type"
      }
  }
  ]).pretty()
  </code></pre>
  
  <p>This solution returns only the list of members, so what i have to do to get a list containing all the resellers, the clients and the members all together?</p>