Which is proper $elemMatch syntax in Compass?

Hi there,
I am trying to use $elemMatch in Compass but it doesn’t work. I don’t know why.
image

The filter is red and the button find disables on hover.
I was found this example in the documentation https://docs.mongodb.com/manual/tutorial/query-arrays/#specify-multiple-criteria-for-array-elements

image

Any advice are highly appreciated :grinning:

Hi

The exact same syntax works for me:

I had the same issue for a while, it seems that Compass is very sensitive.
Things that helped:

  • reset the query before inputting the filter.
  • do not copy/paste the filter, type it in.
  • disconnect/reconnect to the DB, especially if you are low on memory on the computer
2 Likes

Thanks @alex_07739 for your reply :grinning: Your solution did solve the problem!

2 Likes