MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Driver C# - Filter by category, regardless of level?

I’m using the latest C # driver. I want to filter by idcategoria, regardless of level.
I´m trying:

var filter = Builders<Bsondocument>.Filter.In("idcategoria", new [] { 139,241 } );

but don´t work.
My database looks like:

canal_1 
  nichos
     categorias 
         idcategoria=135
         descricao=loren ipsun

         subcategorias
           idcategoria=139
           descricao=loren ipsun    


canal_2
   nichos
      categorias
         idcategoria=200
         descricao=loren ipsun

         subcategorias
            idcategoria=241
            descricao=loren ipsun . . . 

does anyone have an idea?

this way it works:

var filter = Builders<Bsondocument>.Filter.In("canal_1.nichos.categorias.idcategoria", new [] { 139,241 } );
but I believe there are better ways