Will mongodb partial index work with exists clause?

28 Views Asked by At

I have a partial index as follows

{
    "$and" : [
        {
            "field1" : {
                "$exists" : true
            }
        },
        {
            "field2" : {
                "$exists" : true
            }
        }
    ]
}

will query like

{ $and : [{ "field1" : { "$ne" : null } }, { "field2" : { "$ne" : null } }] }

use above index? Also

{$and : [{"field1" : {"$exists" : true}}, {"field2" : {"$exists" : true}}]}

use above index?

0

There are 0 best solutions below