title: Get documents using conditional filter MongoDB
body: <p>I am performing translation on a site. It has following db structure with version <strong>3.6</strong>:</p>
  <pre><code>{
      _id: XXXXXXXXXXXX,
      &quot;title&quot;: &quot;hello&quot;,
      &quot;description&quot;: &quot;test 123&quot;,
      &quot;language_code&quot;: &quot;en&quot; 
  }
  </code></pre>
  <p>By default the site is loaded in english language, which works fine. But If change the language to suppose spanish:</p>
  <ul>
  <li>If no content is added for spanish then by default english content should be displayed for spanish</li>
  <li>If content is added for spanish (with language code es in the db) then it should show spanish language content.</li>
  </ul>
  <p>I have tried following query:</p>
  <pre><code>db.sections.find({
      $expr: {
          $eq:[
              {$cond: [ { $eq: [ &quot;$language_code&quot;, &quot;es&quot; ] }, &quot;es&quot;, &quot;en&quot; ] },
              &quot;$language_code&quot; 
          ]
      }
  })
  </code></pre>
  <p>But when the content is added for both en &amp; es then it is returning data for both languages.</p>
  <p>What is wrong with this query ? How can return content conditionally that if no content found for es then return en content else return es content ?</p>
  <p>Any help will be appreciated.</p>