title: MongoDB Fluent Aggregate Conditional Stages
body: <p>When using the Fluent aggregation interface, why doesn't the stages added later not work (stage 3)?</p>
  <pre><code>var fluentPipeline = _userToGroup.Aggregate()
              .AppendStage&lt;BsonDocument&gt;(&quot;stage 1&quot;)
              .AppendStage&lt;BsonDocument&gt;(&quot;stage 2&quot;);
  if (condition)
      fluentPipeline.AppendStage&lt;BsonDocument&gt;(&quot;stage 3&quot;);
  fluentPipeline.ToListAsync();
  </code></pre>
  <p>Stage 3 works when added to the pipeline in the same code line like below. Which means it is not a problem with the stage but how the stage is added to the pipeline as I understand it. The question is why?</p>
  <pre><code>var fluentPipeline = _userToGroup.Aggregate()
              .AppendStage&lt;BsonDocument&gt;(&quot;stage 1&quot;)
              .AppendStage&lt;BsonDocument&gt;(&quot;stage 2&quot;)
              .AppendStage&lt;BsonDocument&gt;(&quot;stage 3&quot;);
  </code></pre>