Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

$or in mongodb compass

I’m trying for mongo db to show me only the pokemons that are Grass or Water trype, but it won’t let me filter it.
$or needs to be an array

Is there another way to filter an or?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Make it an array using brackets []:

$or: [{Type_1: "Water"}, {Type_1: "Grass"}]

Documentation for $or

You don’t need the $eq unless using a regular expression

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading