title: .Net Core API with MongoDb, Aggreate().Lookup<> : There is no argument given that corresponds to the required formal parameter
body: <p>I have a API on .Net Core 5.0 and that API has connect with MongoDB.
  I have two collections: one of it is <code>Chat</code> and the other one is <code>ChatHistory</code>.</p>
  <p><code>Chat</code> class:</p>
  <pre class="lang-cs prettyprint-override"><code>public class Chat
  {
      public int ChatID { get; set; }
      public int ChatRating { get; set; }
      public DateTime ChatCreatedTime { get; set; }
      public DateTime ChatEndTime { get; set; }
  }
  
  public class ChatLookedUp : Chat //The property that i needed to use in .Aggregate().Lookup&lt;&gt;
  {
      public List&lt;ChatHistory&gt; ChatHistories { get; set; }
  }
  </code></pre>
  <p><code>ChatHistory</code> class:</p>
  <pre class="lang-cs prettyprint-override"><code>public class ChatHistory
  {
      public int ChatHistoryID { get; set; }
      public int ChatID { get; set; } //ForeignKey which i'm planning to use in join query
      public string ChatMessage { get; set; }
      public bool IsItWrittenByBot { get; set; }
      public DateTime ChatMessageDate { get; set; }
  }
  </code></pre>
  <p>All I want to do is call the <code>Chat</code> with its <code>ChatHistory</code>. I want to <code>join</code> as I do in SQL.</p>
  <p>I think I'm doing it the right way by using <code>Aggragate().Lookup&lt;&gt;</code> but it's giving me a error like</p>
  <blockquote>
  <p>There is no argument given that corresponds to the required formal parameter 'as' of 'IAggregateFluentExtensions.Lookup&lt;TResult, TForeignDocument, TNewResult&gt;(IAggregateFluent, IMongoCollection, Expression&lt;Func&lt;TResult, object&gt;&gt;, Expression&lt;Func&lt;TForeignDocument, object&gt;&gt;, Expression&lt;Func&lt;TNewResult, object&gt;&gt;, AggregateLookupOptions&lt;TForeignDocument, TNewResult&gt;)'</p>
  </blockquote>
  <p>I didn't understand that problem and I don't know which thing I'm doing wrong.</p>
  <p>The code</p>
  <pre><code>[HttpGet]
  public JsonResult Chats()
  {
      MongoClient DbClient = new MongoClient(_configuration.GetConnectionString(&quot;ChatBotDb&quot;));
      var allChats = DbClient.GetDatabase(&quot;ExampleDB&quot;).GetCollection&lt;Chat&gt;(&quot;Chats&quot;);
      var allChatHistory = DbClient.GetDatabase(&quot;ExampleDB&quot;).GetCollection&lt;Chat&gt;(&quot;ChatHistory&quot;);
      var result = allChats.Aggregate().Lookup&lt;Chat, ChatHistory, ChatLookedUp&gt; // this line is giving me error.
  (allChatHistory, x =&gt; x.ChatID, x =&gt; x.ChatID).ToList();
      return new JsonResult(result);
  }
  </code></pre>