You want to use $elemMatch.
db.foo.findOne({ data: { $elemMatch : {
start: { $lte: 5 },
end: { $gte: 5 }
}}
})
More Related Contents:
- Does MongoDB’s $in clause guarantee order
- Find document with array that contains a specific value
- Update field in exact element array in MongoDB
- Authentication failure while trying to save to mongodb
- Possibility of duplicate Mongo ObjectId’s being generated in two different collections?
- How to change the type of a field?
- MongoDB logging all queries
- Return only matched sub-document elements within a nested array
- Converting string to date in mongodb
- Querying internal array size in MongoDB
- How to delete N numbers of documents in mongodb
- How do I query for distinct values in Mongoose?
- How to insert an element to MongoDB internal list?
- How do I do a “NOT IN” query in Mongo?
- How to efficiently perform “distinct” with multiple keys?
- Hierarchical queries with Mongo using $graphLookup
- Remove embedded document in a nested array of documents
- Find all documents within last n days
- Unable to create/open lock file: /data/mongod.lock errno:13 Permission denied
- Search on multiple collections in MongoDB
- Image returned from REST API always displays broken
- MongoDB: Server has startup warnings ”Access control is not enabled for the database”
- Mongo group and push: pushing all fields
- MongoDB nested array query
- Remove multiple documents from mongo in a single query
- How to check if an array field contains a unique value or another array in MongoDB?
- MongoDB.service failed with result exit-code
- How can I sort a Meteor collection by time of insertion?
- How to filter fields from a mongo document with the official mongo-go-driver
- MongoDB aggregate within daily grouping [duplicate]