Home > database >  $or in mongodb compass
$or in mongodb compass

Time:07-28

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?

CodePudding user response:

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

  • Related