title: Yii2 MongoDB query not working
body: <p>I was using MySQL for my db before and moved to using MongoDB just recently. I have been converting my queries to MongoDB format then I encountered a problem along the way. </p>
  
  <p>I wanted to get the <code>payslip_id</code> of a specific user where <code>date_generated</code> (of the payslip) is in between the start and end dates of a specific payroll period. Here's the original query (MySQL):</p>
  
  <pre><code>public function getPayslipDetails()
  {  
      $time = date_default_timezone_set('Asia/Manila');
      $time = date('Y/m/d', time());
      $session = Yii::$app-&gt;session; 
  
      return $this-&gt;hasOne(Payslip::className(), ['user_id' =&gt; 'user_id'])-&gt;where('date_generated BETWEEN :start_time AND :end_time', array(':start_time' =&gt; $session['start'], ':end_time' =&gt; $session['end'])); 
  }
  
  public function getPayslipID() 
  {    
      return $this-&gt;payslipDetails ? $this-&gt;payslipDetails-&gt;payslip_id : '';
  }
  </code></pre>
  
  <p>Now, here's my converted query to MongoDB:</p>
  
  <pre><code>public function getPayslipDetails()
  {  
      $time = date_default_timezone_set('Asia/Manila');
      $time = date('Y/m/d', time());
      $session = Yii::$app-&gt;session; 
  
      return $this-&gt;hasOne(Payslip::className(), ['user_id' =&gt; '_id'])-&gt;where(array('date_generated' =&gt;  array('$in' =&gt; array($session['start'], $session['end']))));  
  }
  
  public function getPayslipID() 
  {    
      return $this-&gt;payslipDetails ? $this-&gt;payslipDetails-&gt;_id : '';
  }
  </code></pre>
  
  <p>Notice the return statements are different. I wonder if my MongoDB query is correct or not. It doesn't return any error as well. </p>
  
  <p>I would really appreciate your response.</p>