I believe you want imgs.0
. eg, given your example document, you want to say: db.products.find({"imgs.0": "http://foo.jpg"})
Be aware that referencing array indexes only works for the first-level array. Mongo doesn’t support searching array indexes any deeper.
More Related Contents:
- How to Update Multiple Array Elements in mongodb
- MongoDB – Query on the last element of an array?
- $in requires an array as a second argument, found: missing
- MongoDB: find and findOne with nested array filtering
- MongoDB: How do I update a single subelement in an array, referenced by the index within the array?
- Updating nested arrays in mongodb
- mongodb find by multiple array items
- Update nested subdocuments in MongoDB with arrayFilters
- Get particular element from mongoDB array [duplicate]
- 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]
- Removing the array element in mongoDB based on the position of element
- Can you have mongo $push prepend instead of append?
- listing directories and sub-directories to an array with path;
- How do I do multiple assignment in MATLAB?
- Array versus linked-list
- Swift sort an array with strings and numbers [duplicate]
- how to combine duplicate rows and sum the values 3 column in excel
- How to return first 5 objects of Array in Swift?
- Return actual type of a field in MongoDB
- How do I remove elements at a set of indices in a vector in MATLAB?
- How to forward functions with variadic parameters?
- How do I Merge two Arrays in VBA?
- Excel VBA Quickest way to sort an array of numbers in descending order?
- How can I store function pointers in an array? [duplicate]
- Is there any way to allocate a standard Rust array directly on the heap, skipping the stack entirely?
- jq: recursively merge objects and concatenate arrays
- Swift: Binary search for standard array?