title: MongoDB - How can I check if some element in an array meets a condition with another element of an array?
body: <p>I have the following objects in my Java APP:</p>
  
  <pre><code>[
    {
      "from" : "11/12/2020",
      "to" : "12/12/2019"
    },
    {
      "from" : "13/12/2020",
      "to" : "14/12/2020
    }
  ]
  </code></pre>
  
  <p>and in my DB I have the following objects:</p>
  
  <pre><code>[
    {
      "from" : "01/12/2020",
      "to" : "14/12/2019"
    },
    {
      "from" : "20/12/2020",
      "to" : "30/12/2020
    }
  ]
  </code></pre>
  
  <p>What query can I write to check if any of the dates <code>from</code> or <code>to</code> from any object in my first Java APP will be gte or lte than any of the <code>from</code> or <code>to</code> values from my DB objects?</p>
  
  <p>Thanks!</p>