JyotiChhetri
JyotiChhetri

Reputation: 299

How to solve 'MongoError: $where is not allowed in this atlas tier'?

I had the following query which was working in my local mongodb but when I switched to atlas, its giving me

MongoError: $where is not allowed in this atlas tier

I looked at similar post, but could not find answer

await Markertag.find( { $where: 'this.markerNum.toString().match(' + search.searchText + ')' }).distinct('photoId');

Upvotes: 0

Views: 3099

Answers (1)

Styx
Styx

Reputation: 10076

Unsupported Commands in M0/M2/M5 Clusters.

The following commands exhibit special behavior in M0 Free Tier and M2/M5 shared starter clusters:

...

distinct - The $where operator is not supported.

find - The $where operator is not supported.

...

You should either upgrade your tier to paid one, or chose another MongoDB provider.

Upvotes: 1

Related Questions