title: Loading linked documents MongoDB Driver
body: <p>I have a document which is being loaded by the MongoDB driver.</p>
  
  <p>The problem is this document has another linked document by the <code>ObjectId</code>.</p>
  
  <p>Since for my application I need the first document fully loaded, I'm loading the linked document through an <code>IEnumerable</code> as follows:</p>
  
  <pre><code>IMongoDatabase Database { get; set; }
  
  public class Document1 {
    [BsonId]
    public ObjectId Id;
    public ObjectId Document2Id;
  
    [BsonIgnore]
    public Document2 Document2;
  }
  
  public class Document2 {
    [BsonId]
    public ObjectId Id;
    public string Foo;
    public string Bar;
  }
  
  public IEnumerable&lt;Document1&gt; List() {
      var 1documents = Database.GetCollection&lt;Document1&gt;("1documents");
      var 2documents = Database.GetCollection&lt;Document2&gt;("2documents");
  
      foreach(var document in 1documents.AsEnumerable()) {
        document.Document2 = 2documents
                                .AsEnumerable()
                                .FirstOrDefault(d =&gt; d.ID == document.Document2Id);
        yield return document;
      }
  }
  </code></pre>
  
  <p>My problem is that the load of the Document2 is taking too long. I have a little over 500 records, which I consider a small database. And each load is taking 500ms.</p>
  
  <p>Is there any other way to load linked documents through MongoDB C# Driver?</p>