title: How to express if-then-else MongoDB aggregation?
body: <p>Say we have a collection with this document structure</p>
  <pre><code>{
     &quot;full&quot;: &lt;string&gt;,
     &quot;first&quot;: &lt;string&gt;,
     &quot;last&quot;: &lt;string&gt;
  }
  </code></pre>
  <p>Looking for an expression in <code>$project</code> with the following logic</p>
  <pre><code>if (&quot;$full&quot; is null or absent)
     concatenate (&quot;$first&quot;, &quot;_&quot; , &quot;$last&quot;)
  else
     &quot;$full&quot;
  </code></pre>
  <p>I have managed to write this, but it does not work properly for some cases and looks huge</p>
  <pre><code>$project: {
    &quot;fullName&quot;: {
      $cond: {
        if: { &quot;$full&quot;: null },
        then: { $concat: [ &quot;$first&quot;, &quot;_&quot;, &quot;$last&quot; ] }, 
        else: &quot;$full&quot;
      }
    }
  }
  </code></pre>
  <p>What is a concise way to express this intention in MongoDB aggregation?</p>