Check all elements of all subfields

  Kiến thức lập trình

How to check all elements in all subfields of a field without explicitly writing the names of the subfields? For example, I have a document like this: {"field": {"sub1": ["IC42", "IC38"], "sub2": ["BH90", "BH70"]}}, I want something like iterating through all subfields and checking whether any of them has the text “IC42”

I don’t want to use mongodb atlas search because it can produce unexpected results

New contributor

Lilac is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT