title: Mongodb search data except ranges
body: <p>I have one collection and here is documents. Each document have own unique number, which increases:</p>
  
  <pre><code>{
      code: 1
  }, {
      code: 2
  }, {
      code: 3
  }, {
      code: 4
  }, {
      code: 5
  }, {
      code: 6
  }, {
      code: 7
  }, {
      code: 8
  }, {
      code: 9
  }, {
      code: 10
  }
  </code></pre>
  
  <p>Now what I have to do, to get only documents which is not in range of (2, 5) and (7, 9)?</p>
  
  <p>Result must be: </p>
  
  <pre><code>{
      code: 1
  }, {
      code: 6
  }, {
      code: 10
  }
  </code></pre>
  
  <p>So, I want to make this on big collection, for example collection which have 3000 document and "Except ranges" will be 4 - 5.</p>
  
  <p>I tried some queries, but it's not working properly:</p>
  
  <pre><code>{ "course": ObjectId("123"), "code": { $gt: NumberInt(300) }, "code": { $lt: NumberInt(400) }, "code": { $gt: NumberInt(500) }, "code": { $lt: NumberInt(800) } }
  </code></pre>