title: Populate with condition return null in mongoose
body: <p>I need to get all production results where machine name is 'CircuitPrinter'</p>
  <p>ProductionResult schema:</p>
  <pre><code>import { Schema, model } from 'mongoose';
  
  const schemaOptions = {
      timestamps: { createdAt: 'created_at', updatedAt: false },
  };
  
  const productionResultSchema = new Schema({
      machineId: { type: Schema.Types.ObjectId, ref: 'Machine' },
      operatorId: { type: Schema.Types.ObjectId, ref: 'Operator' },
      orderId: { type: Schema.Types.ObjectId, ref: 'Order' },
      elementId: { type: Schema.Types.ObjectId, ref: 'Element' },
  }, schemaOptions);
  
  export default model('ProductionResult', productionResultSchema);
  </code></pre>
  <p>Machine Schema</p>
  <pre><code>import { Schema, model } from 'mongoose';
  
  const schemaOptions = {
      timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' },
  };
  
  const machineSchema = new Schema({
      name: { type: String },
      status: { type: String },
      date: { type: Date },
      amount: { type: Number },
  }, schemaOptions);
  
  export default model('Machine', machineSchema);
  </code></pre>
  <p>Service function:</p>
  <pre><code>async getBar() {
          return ProductionResult.find()
              .populate({
                  path: 'machineId',
                  match: { name: 'CircuitPrinter' },
              });
      }
  </code></pre>
  <p>But in response I get machineId with null
  Without <code>match</code> I get correct response with full machine data. What's wrong with my condition. Machine with <code>CircuitPrinter</code> name exist in database.</p>
  <pre><code>{
      &quot;_id&quot;: &quot;608c532e4051960ef05176f4&quot;,
      &quot;machineId&quot;: null,
      &quot;elementId&quot;: &quot;608c4e914051960ef05176cc&quot;,
      &quot;operatorId&quot;: &quot;608c4e914051960ef05176d2&quot;,
      &quot;orderId&quot;: &quot;608c4e914051960ef05176eb&quot;,
      &quot;created_at&quot;: &quot;2021-04-30T18:57:50.771Z&quot;,
      &quot;__v&quot;: 0
  }
  </code></pre>
  <p>Edited:</p>
  <p>Sample data Machines document:</p>
  <pre><code>{
      &quot;_id&quot;: {
          &quot;$oid&quot;: &quot;608c4e914051960ef05176ed&quot;
      },
      &quot;name&quot;: &quot;CircuitPrinter&quot;,
      &quot;status&quot;: &quot;Running&quot;,
      &quot;__v&quot;: 0,
      &quot;created_at&quot;: {
          &quot;$date&quot;: &quot;2021-04-30T18:38:09.326Z&quot;
      },
      &quot;updated_at&quot;: {
          &quot;$date&quot;: &quot;2021-04-30T18:38:09.326Z&quot;
      }
  }
  </code></pre>
  <p>Sample data ProductionResult document:</p>
  <pre><code>{
      &quot;_id&quot;: {
          &quot;$oid&quot;: &quot;608c532e4051960ef05176f4&quot;
      },
      &quot;machineId&quot;: {
          &quot;$oid&quot;: &quot;608c4e914051960ef05176f0&quot;
      },
      &quot;elementId&quot;: {
          &quot;$oid&quot;: &quot;608c4e914051960ef05176cc&quot;
      },
      &quot;operatorId&quot;: {
          &quot;$oid&quot;: &quot;608c4e914051960ef05176d2&quot;
      },
      &quot;orderId&quot;: {
          &quot;$oid&quot;: &quot;608c4e914051960ef05176eb&quot;
      },
      &quot;created_at&quot;: {
          &quot;$date&quot;: &quot;2021-04-30T18:57:50.771Z&quot;
      },
      &quot;__v&quot;: 0
  }
  </code></pre>