The main reason having dynamic field names is not recommended is that it complicates simple things like this.
With the attribute pattern this is easy to solve. A simple query like
"tables.v" : { "$gt" : 0 }
would suffice.
One way to do it with your current schema would be to use aggregation with a $set stage that uses $objectToArray to essentially dynamically convert your table into the attribute pattern. The a $match that uses the simple query above should work.
Another way is to use map on NAMES to create a big “$or” query that would end up looking like: