My files have a structure similar to this:
https://i.stack.imgur.com/KyaVY.png
When a user conducts a search, they send an array to the backend. This array always includes at least one element.
For example, if they send ['javascript']
to the backend. Is there a method to query MongoDB to identify which documents contain the term javascript
?
I attempted something like,
db.find({ body: { $all:['javascript'] } });
However, this only functions if body
is also an array. Are there any other ways to achieve this?