title: unwind array of Objects in mongoDB
body: <p>I have 2 tables booking and parking. In the booking table there is parkingId which refers to parking model. In the parking model there is a field named availability which is following:</p>
  <pre><code>[
      {
        &quot;day&quot;: &quot;Monday&quot;,
        &quot;startTime&quot;: &quot;09:00&quot;,
        &quot;endTime&quot;: &quot;17:00&quot;,
      },
      {... //Other days}
  ]
  </code></pre>
  <p>I want to unwind the availability array.</p>
  <p>I have tried this:</p>
  <pre><code>let startTime = await Booking.aggregate([
        {
          $match: { _id: new mongoose.Types.ObjectId(req.params.id) },
        },
        {
          $lookup: {
            from: &quot;parkings&quot;,
            localField: &quot;parkingId&quot;,
            foreignField: &quot;_id&quot;,
            as: &quot;parking&quot;,
          },
        },
        {
          $unwind: &quot;$parking&quot;,
        },
        { $unwind: &quot;$parking.availability&quot; },
      ]);
  </code></pre>
  <p>But it logs the result 6 times because there are 6 objects in the availability array like following.</p>
  <pre><code>[{
      _id: new ObjectId(&quot;62e8ac3943a6bfaf80de75b5&quot;),
      parkingId: new ObjectId(&quot;62e11ab3079daa939290fa07&quot;),
      user: new ObjectId(&quot;62c950dfc96c2b690028be88&quot;),
      date: 2022-07-26T00:00:00.000Z,
      startTime: 2022-07-26T09:30:00.000Z,
      duration: { days: 0, hours: 2, minutes: 0 },
      endTime: 2022-07-26T11:30:00.000Z,
      isFeePaid: false,
      status: 'sent',
      isBookingCancelled: { value: false },
      isStarted: false,
      isEnabled: false,
      parking: {
        _id: new ObjectId(&quot;62e11ab3079daa939290fa07&quot;),
        userId: new ObjectId(&quot;62c950dfc96c2b690028be88&quot;),
        contactInfo: [Object],
        about: 'Nisi occaecat ipsum',
        parkingImage: [],
        location: [Array],
        price: 5,
        availability: [Object],
        parkingType: 'residence',
        parkingInfo: [Array],
        totalSpots: 10,
        coordinates: [Object],
        status: 'active',
        isFeePaid: false,
      }
    },
  ]
  </code></pre>
  <p>I want only availability data but it prints <code>availability: [Object]</code></p>