title: How do I solve: 'MongoError: $where is not allowed in this atlas tier'?
body: <p>How do I solve: 'MongoError: $where is not allowed in this atlas tier' when using MongoDB Atlas?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>async function getEventsTakingPlace(){
      const getEventsTakingPlace = await event.find({$where: function() { 
          return ((this.eventTime &lt; new Date()) &amp;&amp; (new Date(this.eventTime).getTime()+ 100*60000 &gt; new Date().getTime() ) ) }},
          function(err, events){
          if(err){
              return err;
          }else {
              return events; 
          }
      }); 
      return getEventsTakingPlace 
  };
  </code></pre>
  
  <p>when I use my local mongoDB instance it works but once i start ising mongoAtlas I get the error: $where is not allowed in this atlas tier. How do I solve this?</p>