Query MongoDB using Date datatype


I’m querying MongoDB using Date datatype -
eg:- {“date”:new Date(“2021-06-23T08:30:00.000+00:00”)}
It queries correctly and gives proper results in MongoDB shell and Compass but when I try to query the same query in the MongoDB cloud cluster it throws an error " The provided parameters were invalid. Check your query and try again".
Can someone please help?