Depends on whether you’re trying to find documents where words
contains both elements (text
and here
) using $all
:
db.things.find({ words: { $all: ["text", "here"] }});
or either of them (text
or here
) using $in
:
db.things.find({ words: { $in: ["text", "here"] }});
More Related Contents:
- How to Update Multiple Array Elements in mongodb
- Searching array reports “not found” even though it’s found
- MongoDB: How do I update a single subelement in an array, referenced by the index within the array?
- Updating nested arrays in mongodb
- Update nested subdocuments in MongoDB with arrayFilters
- Find the 2nd largest element in an array with minimum number of comparisons
- Get particular element from mongoDB array [duplicate]
- MongoDB – Query on the last element of an array?
- MongoDB update multiple records of array [duplicate]
- Remove a field from all elements in array in mongodb [duplicate]
- MongoDB rename database field within array
- Updating nested array inside array mongodb [duplicate]
- $in requires an array as a second argument, found: missing
- Removing the array element in mongoDB based on the position of element
- MongoDB: find and findOne with nested array filtering
- Check if an element is present in a Bash array [duplicate]
- Querying MongoDB to match in the first item in an array
- Can you have mongo $push prepend instead of append?
- how to check if there is any string from index 0 to 5 in an array of type Any [closed]
- Easy interview question got harder: given numbers 1..100, find the missing number(s) given exactly k are missing
- Passing arrays as parameters in bash
- How to iterate over array of objects in Handlebars?
- Find cosine similarity between two arrays
- How to split a string by new lines in Swift
- How can I initialize an array using a function? [duplicate]
- Class-validator – validate array of objects
- Convert Byte Array to image and display in Razor View
- Extending Array to check if it is sorted in Swift?
- jsonb vs jsonb[] for multiple addresses for a customer
- How does Array#sort work when a block is passed?