Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-23038

Why index dosn't working?

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.2.3
    • None
    • Environment:
      WINDOWS 2008 R2
    • Windows
    • Hide

      index:

      {
          "uid" : -1,
          "infor.orderStatus" : 1,
          "exts.post_his.unpostids" : 1,
          "infor.gmtModified" : -1,
          "exts.dvy_sign.issigned" : 1,
          "infor.issueInfo.issueStatus" : 1
      }
      

      when I run the finding code:

      db.getCollection('w_trade_aliexpress').find({
                          "uid" : 3630,
                          "infor.gmtModified" : {
                              "$gt" : ISODate("2016-02-03T00:30:08.000+08:00"),
                              "$lt" : ISODate("2016-03-06T15:56:07.670+08:00")
                          },
                          "exts.post_his.unpostids" : "56c5666bef68fc0e28524dd5",
                          "exts.dvy_sign.issigned" : true,
                          "infor.orderStatus" : "FINISH"
                      }).explain()
      

      the explain:

      /* 1 */
      {
          "queryPlanner" : {
              "plannerVersion" : 1,
              "namespace" : "wxwdb.w_trade_aliexpress",
              "indexFilterSet" : false,
              "parsedQuery" : {
                  "$and" : [ 
                      {
                          "exts.dvy_sign.issigned" : {
                              "$eq" : true
                          }
                      }, 
                      {
                          "exts.post_his.unpostids" : {
                              "$eq" : "56c5666bef68fc0e28524dd5"
                          }
                      }, 
                      {
                          "infor.orderStatus" : {
                              "$eq" : "FINISH"
                          }
                      }, 
                      {
                          "uid" : {
                              "$eq" : 3630
                          }
                      }, 
                      {
                          "infor.gmtModified" : {
                              "$lt" : ISODate("2016-03-06T15:56:07.670+08:00")
                          }
                      }, 
                      {
                          "infor.gmtModified" : {
                              "$gt" : ISODate("2016-02-03T00:30:08.000+08:00")
                          }
                      }
                  ]
              },
              "winningPlan" : {
                  "stage" : "FETCH",
                  "filter" : {
                      "$and" : [ 
                          {
                              "exts.post_his.unpostids" : {
                                  "$eq" : "56c5666bef68fc0e28524dd5"
                              }
                          }, 
                          {
                              "infor.gmtModified" : {
                                  "$lt" : ISODate("2016-03-06T15:56:07.670+08:00")
                              }
                          }, 
                          {
                              "infor.gmtModified" : {
                                  "$gt" : ISODate("2016-02-03T00:30:08.000+08:00")
                              }
                          }
                      ]
                  },
                  "inputStage" : {
                      "stage" : "IXSCAN",
                      "keyPattern" : {
                          "uid" : -1,
                          "infor.orderStatus" : 1,
                          "exts.post_his.unpostids" : 1,
                          "infor.gmtModified" : -1,
                          "exts.dvy_sign.issigned" : 1,
                          "infor.issueInfo.issueStatus" : 1
                      },
                      "indexName" : "posting2",
                      "isMultiKey" : true,
                      "isUnique" : false,
                      "isSparse" : false,
                      "isPartial" : false,
                      "indexVersion" : 1,
                      "direction" : "forward",
                      "indexBounds" : {
                          "uid" : [ 
                              "[3630.0, 3630.0]"
                          ],
                          "infor.orderStatus" : [ 
                              "[\"FINISH\", \"FINISH\"]"
                          ],
                          "exts.post_his.unpostids" : [ 
                              "[MinKey, MaxKey]"
                          ],
                          "infor.gmtModified" : [ 
                              "[MaxKey, MinKey]"
                          ],
                          "exts.dvy_sign.issigned" : [ 
                              "[true, true]"
                          ],
                          "infor.issueInfo.issueStatus" : [ 
                              "[MinKey, MaxKey]"
                          ]
                      }
                  }
              },
              "rejectedPlans" : [ 
                  {
                      "stage" : "FETCH",
                      "filter" : {
                          "$and" : [ 
                              {
                                  "exts.dvy_sign.issigned" : {
                                      "$eq" : true
                                  }
                              }, 
                              {
                                  "exts.post_his.unpostids" : {
                                      "$eq" : "56c5666bef68fc0e28524dd5"
                                  }
                              }, 
                              {
                                  "infor.orderStatus" : {
                                      "$eq" : "FINISH"
                                  }
                              }, 
                              {
                                  "infor.gmtModified" : {
                                      "$lt" : ISODate("2016-03-06T15:56:07.670+08:00")
                                  }
                              }, 
                              {
                                  "infor.gmtModified" : {
                                      "$gt" : ISODate("2016-02-03T00:30:08.000+08:00")
                                  }
                              }
                          ]
                      },
                      "inputStage" : {
                          "stage" : "IXSCAN",
                          "keyPattern" : {
                              "uid" : -1,
                              "infor.id" : -1
                          },
                          "indexName" : "uid_-1_infor.id_-1",
                          "isMultiKey" : false,
                          "isUnique" : false,
                          "isSparse" : false,
                          "isPartial" : false,
                          "indexVersion" : 1,
                          "direction" : "forward",
                          "indexBounds" : {
                              "uid" : [ 
                                  "[3630.0, 3630.0]"
                              ],
                              "infor.id" : [ 
                                  "[MaxKey, MinKey]"
                              ]
                          }
                      }
                  }, 
                  {
                      "stage" : "FETCH",
                      "filter" : {
                          "$and" : [ 
                              {
                                  "exts.dvy_sign.issigned" : {
                                      "$eq" : true
                                  }
                              }, 
                              {
                                  "exts.post_his.unpostids" : {
                                      "$eq" : "56c5666bef68fc0e28524dd5"
                                  }
                              }, 
                              {
                                  "infor.orderStatus" : {
                                      "$eq" : "FINISH"
                                  }
                              }, 
                              {
                                  "infor.gmtModified" : {
                                      "$lt" : ISODate("2016-03-06T15:56:07.670+08:00")
                                  }
                              }, 
                              {
                                  "infor.gmtModified" : {
                                      "$gt" : ISODate("2016-02-03T00:30:08.000+08:00")
                                  }
                              }
                          ]
                      },
                      "inputStage" : {
                          "stage" : "IXSCAN",
                          "keyPattern" : {
                              "uid" : 1,
                              "exts.eval.evaluatetime" : -1
                          },
                          "indexName" : "uid_1_exts.eval.evaluatetime_-1",
                          "isMultiKey" : false,
                          "isUnique" : false,
                          "isSparse" : false,
                          "isPartial" : false,
                          "indexVersion" : 1,
                          "direction" : "forward",
                          "indexBounds" : {
                              "uid" : [ 
                                  "[3630.0, 3630.0]"
                              ],
                              "exts.eval.evaluatetime" : [ 
                                  "[MaxKey, MinKey]"
                              ]
                          }
                      }
                  }
              ]
          },
          "serverInfo" : {
              "host" : "jstw4vbjuh7q7c",
              "port" : 3005,
              "version" : "3.2.3",
              "gitVersion" : "b326ba837cf6f49d65c2f85e1b70f6f31ece7937"
          },
          "ok" : 1
      }
      
      Show
      index: { "uid" : -1, "infor.orderStatus" : 1, "exts.post_his.unpostids" : 1, "infor.gmtModified" : -1, "exts.dvy_sign.issigned" : 1, "infor.issueInfo.issueStatus" : 1 } when I run the finding code: db.getCollection('w_trade_aliexpress').find({ "uid" : 3630, "infor.gmtModified" : { "$gt" : ISODate("2016-02-03T00:30:08.000+08:00"), "$lt" : ISODate("2016-03-06T15:56:07.670+08:00") }, "exts.post_his.unpostids" : "56c5666bef68fc0e28524dd5", "exts.dvy_sign.issigned" : true, "infor.orderStatus" : "FINISH" }).explain() the explain: /* 1 */ { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "wxwdb.w_trade_aliexpress", "indexFilterSet" : false, "parsedQuery" : { "$and" : [ { "exts.dvy_sign.issigned" : { "$eq" : true } }, { "exts.post_his.unpostids" : { "$eq" : "56c5666bef68fc0e28524dd5" } }, { "infor.orderStatus" : { "$eq" : "FINISH" } }, { "uid" : { "$eq" : 3630 } }, { "infor.gmtModified" : { "$lt" : ISODate("2016-03-06T15:56:07.670+08:00") } }, { "infor.gmtModified" : { "$gt" : ISODate("2016-02-03T00:30:08.000+08:00") } } ] }, "winningPlan" : { "stage" : "FETCH", "filter" : { "$and" : [ { "exts.post_his.unpostids" : { "$eq" : "56c5666bef68fc0e28524dd5" } }, { "infor.gmtModified" : { "$lt" : ISODate("2016-03-06T15:56:07.670+08:00") } }, { "infor.gmtModified" : { "$gt" : ISODate("2016-02-03T00:30:08.000+08:00") } } ] }, "inputStage" : { "stage" : "IXSCAN", "keyPattern" : { "uid" : -1, "infor.orderStatus" : 1, "exts.post_his.unpostids" : 1, "infor.gmtModified" : -1, "exts.dvy_sign.issigned" : 1, "infor.issueInfo.issueStatus" : 1 }, "indexName" : "posting2", "isMultiKey" : true, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 1, "direction" : "forward", "indexBounds" : { "uid" : [ "[3630.0, 3630.0]" ], "infor.orderStatus" : [ "[\"FINISH\", \"FINISH\"]" ], "exts.post_his.unpostids" : [ "[MinKey, MaxKey]" ], "infor.gmtModified" : [ "[MaxKey, MinKey]" ], "exts.dvy_sign.issigned" : [ "[true, true]" ], "infor.issueInfo.issueStatus" : [ "[MinKey, MaxKey]" ] } } }, "rejectedPlans" : [ { "stage" : "FETCH", "filter" : { "$and" : [ { "exts.dvy_sign.issigned" : { "$eq" : true } }, { "exts.post_his.unpostids" : { "$eq" : "56c5666bef68fc0e28524dd5" } }, { "infor.orderStatus" : { "$eq" : "FINISH" } }, { "infor.gmtModified" : { "$lt" : ISODate("2016-03-06T15:56:07.670+08:00") } }, { "infor.gmtModified" : { "$gt" : ISODate("2016-02-03T00:30:08.000+08:00") } } ] }, "inputStage" : { "stage" : "IXSCAN", "keyPattern" : { "uid" : -1, "infor.id" : -1 }, "indexName" : "uid_-1_infor.id_-1", "isMultiKey" : false, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 1, "direction" : "forward", "indexBounds" : { "uid" : [ "[3630.0, 3630.0]" ], "infor.id" : [ "[MaxKey, MinKey]" ] } } }, { "stage" : "FETCH", "filter" : { "$and" : [ { "exts.dvy_sign.issigned" : { "$eq" : true } }, { "exts.post_his.unpostids" : { "$eq" : "56c5666bef68fc0e28524dd5" } }, { "infor.orderStatus" : { "$eq" : "FINISH" } }, { "infor.gmtModified" : { "$lt" : ISODate("2016-03-06T15:56:07.670+08:00") } }, { "infor.gmtModified" : { "$gt" : ISODate("2016-02-03T00:30:08.000+08:00") } } ] }, "inputStage" : { "stage" : "IXSCAN", "keyPattern" : { "uid" : 1, "exts.eval.evaluatetime" : -1 }, "indexName" : "uid_1_exts.eval.evaluatetime_-1", "isMultiKey" : false, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 1, "direction" : "forward", "indexBounds" : { "uid" : [ "[3630.0, 3630.0]" ], "exts.eval.evaluatetime" : [ "[MaxKey, MinKey]" ] } } } ] }, "serverInfo" : { "host" : "jstw4vbjuh7q7c", "port" : 3005, "version" : "3.2.3", "gitVersion" : "b326ba837cf6f49d65c2f85e1b70f6f31ece7937" }, "ok" : 1 }

      I have a collection w_trade_aliexpress.
      the index cannot match find item,why?

            Assignee:
            Unassigned Unassigned
            Reporter:
            tianwei02 raylynn
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: