title: How to represent range in mongoose schema?
body: <h2>Background</h2>
  
  <p>Lets say I am doing a schema about fruits that you can buy. In this schema, a fruit has a price range:</p>
  
  <pre><code>let fruit = {
      name: "banana",
      price: {
          currency: "EUR",
          range: [2, 10]
      }
  };
  </code></pre>
  
  <p>To achieve saving the above object, I am trying to use the following schema:</p>
  
  <pre><code>let fruitSchema = {
      name: {type: String, required: true},
      price: {
          currency: {type: String, required: true},
          range: [{
              type: Number,
              min: 0
          }],
          validate: [arraySize]
      }
  };
  
  const arraySize = function arrayLimit(val) {
    return val.length === 2;
  };
  </code></pre>
  
  <h2>Problem:</h2>
  
  <p>My solution to the range part feels clunky, over complicated and doesn't check if the Max range value is bigger than the Min range value, i.e., doesn't check if 10 > 2.</p>
  
  <h2>Question:</h2>
  
  <ul>
  <li>How would you implement a price range in a schema in mongoose ?</li>
  </ul>