Find objects in nested array, mongodb, compass

Bentaiba Miled Basma picture Bentaiba Miled Basma · Feb 21, 2018 · Viewed 7.5k times · Source

I'm using Mongodb database and Compass tool to visualize my data. My collection called 'ProbCancer' looks like that:

probCancers: [
        cases: [
                {
                   case: {
                   bi: Number,
                   age: Number,
                 },
                   level: Number,
                   _id: false,
                }
              ]
            ]

Since I have many objects in the cases array, it's hard to analyze them. I want to only find objects that have level = -1. Is there any way to do this query in compass? Giving the query parameter in db.probCancers.find(query); could be helpful for me as well.

Answer

Igorski picture Igorski · Oct 4, 2018

Unfortunately $elemMatch projections are not supported in Compass. There is an open tracker for the issue. (I don't have enough reputation to comment on Bentaiba's answer.)

Edit1:
The issue above was closed (fixed) Sep 27 2019.