Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB 3.0 explain() result undocumented filter field

I run explain on the following query:

db.explain().find({ site_id:1, dimensions:[], create_date: { $gte: new Date(1452603948196) } )

The result contains a 'filter' object over the dimensions field, while it should have filtered that field using the index, what does it mean ? isn't it a redundant stage?

{ "winningPlan" : {
        "stage" : "FETCH",
        "filter" : {
            "dimensions" : {
                "$eq" : [ ]
            }
        },
        "inputStage" : {
            "stage" : "IXSCAN",
            "keyPattern" : {
                "site_id" : 1,
                "dimensions" : 1,
                "create_date" : 1
            }, }

as far as i understand it means that mongo filter the dimensions field again after it is scanning the index and fetch the documents into memory, is it correct?

thanks,

like image 735
Shachar Avatar asked Nov 08 '22 21:11

Shachar


1 Answers

Your results will be filtered based on the criteria that dimensions are equal to values given in the array.

like image 188
Shalabh Raizada Avatar answered Nov 15 '22 06:11

Shalabh Raizada