title: mongodb - query to return first match record from list of params
body: <p>I have a mongo collection where i have below structure:</p>
  <pre><code>{
     &quot;feature&quot;:&quot;abc&quot;,
     &quot;translations&quot;[
        {
           &quot;lang&quot;:&quot;en&quot;,
           &quot;text&quot;:&quot;This is my text in english&quot;
        },
        {
           &quot;lang&quot;:&quot;de&quot;,
           &quot;text&quot;:&quot;This is my text in german&quot;
        }
     ]
  },
  {
     &quot;feature&quot;:&quot;cde&quot;,
     &quot;translations&quot;[
        {
           &quot;lang&quot;:&quot;en&quot;,
           &quot;text&quot;:&quot;This is my text in english&quot;
        }
     ]
  }
  </code></pre>
  <p>Now, i want to write query to return default language &quot;en&quot; text if particular language ie., de text not found for a particular feature. If both language texts present, only &quot;de&quot; lang text need to be returned and &quot;en&quot; need to be ignored.</p>
  <p>I tried with <code>$or</code> or <code>$in</code>, but these are giving both lang texts if present for a feature. I'm okay to do minimal changes to mongo document structure if required for better results.</p>