I would like to find all documents where element 0 of ingredients is apple. So I want to get document 1 and 3, but not 2. Is such a thing possible natively in Mongo?
The example as it is does not make sense, but my application was too complicated to put up here.
{
    _id => 1
    name => 'best smoothie' 
    ingredients => Array
        (
            [0] => apple
            [1] => raspberry
            [2] => orange
            [3] => banana
        )
}
{
    _id => 2
    name => 'summer smoothie' 
    ingredients => Array
        (
            [0] => lemon
            [1] => mint
            [2] => apple
        )
}
{
    _id => 3
    name => 'yogurt smoothie' 
    ingredients => Array
        (
            [0] => apple
            [1] => blueberry
        )
}
Example borrowed from - Querying array elements with Mongo.
 
     
     
     
    