title: Is there a way to validate related documents in mongoose that is more efficient than .populate() and aggregate it together
body: <p>Given these models:</p>
  
  <p>Products:</p>
  
  <pre><code>const productSchema = new Schema({
      name: String,
      description: String,
      price: Number,
      steps: [{
          type: Schema.Types.ObjectId,
          ref: 'steps'
      }]
  });
  </code></pre>
  
  <p>Steps: </p>
  
  <pre><code>const stepSchema = new Schema({
      name: String,
      minimum: Number,
      maximum: Number,
      items: [
          {
              name: String,
              price: Number
          }
      ]
  });
  </code></pre>
  
  <p>Is there a better way to query an object that has N number of Products and not all products.steps selected without using .populate() (because it will make a request for each value inside the products.steps array) and a for loop to sum all prices included in productSchema and stepSchema?</p>
  
  <p>Exemple of use:</p>
  
  <p>On my documents I've got product collection like this:</p>
  
  <pre><code>[{
      id: 1
      name: Pizza,
      description: "Medium (3 flavors)",
      price: 10,
      steps: [{
          "1",
          "2"
  
      }]
  },
  {
      id: 2
      name: Pizza,
      description: "small (1 flavors)",
      price: 10,
      steps: [{
          "1",
  
      }]
  }]
  </code></pre>
  
  <p>And steps like:</p>
  
  <pre><code>[{
      id: 1
      name: "Flavor",
      minimum: 0,
      maximum: 1,
      items: [
          {
              id: 1
              name: "mozzarella",
              price: 4
          },
          {
              id: 2
              name: "pepperoni",
              price: 5
          }
      ]
  },
  {
      id: 2
      name: "Border",
      minimum: 0,
      maximum: 0,
      items: [
          {
              id: 3
              name: "With normal cheese",
              price: 0
          },
          {
              id: 4
              name: "With special cheese",
              price: 3
          }
      ]
  }]
  </code></pre>
  
  <p>So is there a better way to validade an object like this in my BD with less query and without a for loop?</p>
  
  <pre><code>products: [
      {
          productId: 1,
          price: 30,
          quantity: 3,
          steps: [{
              stepId: 1
              items: [
                  {
                      itemId: 1,
                      price: 4
                  },
                  {
                      itemId: 2,
                      price: 5
                  }
              ]
          }]
  
      }
  ]
  </code></pre>