I have documents akin to the following format:
When a user performs a search, they send an array to the backend. This array contains at least one element.
Say that they send ['javascript']
to the backend. Is there a way to query MongoDB to find out with documents contain the word javascript
?
I tried something like,
db.find({ body: { $all:['javascript'] } });
but that only works if body
is an array as well. Any way to accomplish this?