How do I solve: 'MongoError: $where is not allowed in this atlas tier' when using MongoDB Atlas?
Here is my code:
async function getEventsTakingPlace(){
const getEventsTakingPlace = await event.find({$where: function() {
return ((this.eventTime < new Date()) && (new Date(this.eventTime).getTime()+ 100*60000 > new Date().getTime() ) ) }},
function(err, events){
if(err){
return err;
}else {
return events;
}
});
return getEventsTakingPlace
};
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?