title: Mongodb :: How to find which query is more efficient ? $regex or $in
body: <p>I have below data set in which I have applied two different queries. I want to find out which one is more efficient.</p>
  <pre><code>[
      {
          &quot;arrival&quot;: &quot;Lahore&quot;,
          &quot;departure&quot;: &quot;Karachi&quot;,
          &quot;busService&quot;: &quot;Daewoo&quot;
      },
      {
          &quot;arrival&quot;: &quot;Lahore&quot;,
          &quot;departure&quot;: &quot;Karachi&quot;,
          &quot;busService&quot;: &quot;all&quot;
      },
      {
          &quot;arrival&quot;: &quot;Lahore&quot;,
          &quot;departure&quot;: &quot;all&quot;,
          &quot;busService&quot;: &quot;Daewoo&quot;
      },
      {
          &quot;arrival&quot;: &quot;Lahore&quot;,
          &quot;departure&quot;: &quot;all&quot;,
          &quot;busService&quot;: &quot;all&quot;
      },
      {
          &quot;arrival&quot;: &quot;all&quot;,
          &quot;departure&quot;: &quot;Karachi&quot;,
          &quot;busService&quot;: &quot;Daewoo&quot;
      },
      {
          &quot;arrival&quot;: &quot;all&quot;,
          &quot;departure&quot;: &quot;Karachi&quot;,
          &quot;busService&quot;: &quot;all&quot;
      },
      {
          &quot;arrival&quot;: &quot;all&quot;,
          &quot;departure&quot;: &quot;all&quot;,
          &quot;busService&quot;: &quot;Daewoo&quot;
      },
      {
          &quot;arrival&quot;: &quot;all&quot;,
          &quot;departure&quot;: &quot;all&quot;,
          &quot;busService&quot;: &quot;all&quot;
      }
  ]
  </code></pre>
  <p>In my <code>mongo compass shell</code> i tried these.</p>
  <pre><code>{
     arrival : { $regex: '^(all|Lahore)$', $options: 'i' },
     departure : { $regex: '^(all|Karachi)$', $options: 'i' },
     busService : { $regex: '^(all|Daewoo)$', $options: 'i' }
  }
  </code></pre>
  <p>and</p>
  <pre><code> {
     arrival : { $in : ['all' , 'Lahore'] },
     departure : { $in : ['all' , 'Karachi'] },
     busService : { $in : ['all' , 'Daewoo'] } 
   }
  </code></pre>
  <p>and is there another way to optimize the query ?</p>