title: MongoDB join two collection
body: <p>This is the order entity:</p>
  
  <pre><code>public class Order 
  {
      @Id
      private String id;
      private String internalId;
      private String externalId;
      private String status;
  }
  
  public class OrderAssigned 
  {
      @Id
      private String id;
      private String internalId;
      private String externalId;
      private String stationId;
      private String rejectStatus;
  }
  </code></pre>
  
  <p>I want to join these two collections.</p>
  
  <ul>
  <li>First I want to find <code>stationId</code></li>
  <li>then join <code>Orders.internalId</code> and <code>OrderAssigned.internalId</code> and <code>status = "OrderCreated"</code></li>
  </ul>
  
  <p>Like this SQL query:</p>
  
  <pre><code>select orders.* 
  from PARTNER_RESTAURANT_ORDER orders 
  inner join PARTNER_RESTAURANT_ORDER_ASSIGNED_STATION assigned_station on orders.internalId = assigned_station.internalId 
  where assigned_station.stationId = "5e2968e2763e750001c8ba5f" 
    and orders.status = "OrderCreated"
  </code></pre>