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

the MongoDB query not hit the index

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      mongodb 5.0
      client: java8 spring-boot-starter-data-mongodb 2.3.12.RELEASE

      db:content  table:offline_base

      scema:

       

      {
        "_id": "String",
        "bizId": "String",
        "businessCode": "String",
        "type": "Integer",
        "materialId": "String",
        "title": "String",
        "valid": "Integer",
        "ctime": "Integer",
        "rtime": "Integer",
        "language": "String",
        "coverImage": "String",
        "innerStockInfo": [
          {
            "_id": "String",
            "score": "Float"
          }
        ],
        "content": "String",
        "pic": ["String"],
        "pictureUrls": ["String"],
        "news": {
          "themes": ["String"],
          "sourceUrl": "String",
          "source": "String",
          "copyRight": "Integer"
        },
        "tagInfo": [
          {
            "_id": "Integer",
            "name": "String",
            "wight": "Float",
            "type": "Integer"
          }
        ],
        "important": "Integer",
        "nature": "Integer",
        "classes": ["String"],
        "contentTagMap": "Object",
        "extensions": {
          "knowledgeGraph": "String",
          "uid": "String",
          "fullMarketStockCodes": "String",
          "secEntity": "String",
          "commentOpen": "Boolean",
          "userId": "String"
        },
        "links": ["String"]
      }
      

      index:

      • { "bizId_1_type_1":\{ "v":2, "key":[ [ "bizId", 1.0 ], [ "type", 1.0 ] ], "background":true }

        }

      • { "materialId_1_type_1":\{ "v":2, "key":[ [ "materialId", 1.0 ], [ "type", 1.0 ] ], "background":true }

        }

      • { "_id_":\{ "v":2, "key":[ [ "_id", 1 ] ] }

        }

       

       

      my search query:

       

      db.offline_base.find({type:10,ctime:{$gte:1701428400,$lte:1703073600},bizId:{$in:["326963430","326963470","326963475","326963491","326963492","326963496","326963518","326963545","326963546","326963552","326963551","326963560","326963565","326963576","326963587","326963588","326963591","326963592","326963593","326963596","326963675","326963677","326963678","326963680","326963681","326963695","326963708","326963722","326963721","326963727","326963763","326963764","326963834","326963845","326963852","326963856","326963858","326963892","326963907","326963945","326963988","326964003","326964002","326964036","326964078","326964093","326964088","326964112","326964115","326964116","326964121","326964126","326964128","326964129","326964143","326964144","326964157","326964158","326964194","326964204","326964203","326964206","326964219","326964224","326964231","326964250","326964254","326964258","326964264","326964265","326964266","326964274","326964277","326964287","326964293","326964295","326964322","326964325","326964330","326964348","326964352","326964354","326964353","326964356","326964357","326964370","326964373","326964375","326964379","326964399","326964414","326964415","326964416","326964422","326964427","326964436","326964437","326964443","326964444","326964537","326964538","326964541","326964546","326964549","326964551","326964597","326964633","326964640","326964642","326964643","326964647","326964664","326964666","326964667","326964668","326964669","326964678","326964690","326964749","326964751","326964756","326964785","326964792","326964795","326964800","326964825","326964826","326964855","326964857","326964858","326964877","326964878","326964897","326964930","326964932","326964941","326964943","326964942","326964945","326964949","326964953","326964972","326964978","326965032","326965049","326965056","326965057","326965060","326965059","326965065","326965077","326965080","326965088","326965100","326965107","326965118","326965121","326965127","326965131","326965133","326965136","326965137","326965138","326965139","326965144","326965146","326965147","326965148","326965150","326965151","326965152","326965154","326965153","326965160","326965162","326965166","326965168","326965167","326965170","326965172","326965174","326965179","326965180","326965184","326965187","326965188","326965195","326965200","326965201","326965205","326965208","326965219","326965220","326965228","326965230","326965233","326965236","326965237","326965238","326965240","326965244","326965258","326965288","326965289","326965297","326965304","326965316","326965332","326965336","326965337","326965344","326965352","326965372","326965374","326965387","326965405","326965404","326965408","326965413","326965447","326965474","326965507","326965557","326965559","326965558","326965585","326965587","326965588","326965611","326965662","326965674","326965686","326965721","326965801","326965804","326965803","326965802","326965800","326965805","326965812","326965810","326965807","326965813","326965814","326965815","326965817","326965816","326965822","326965823","326965821","326965819","326965824","326965826","326965820","326965830","326965827","326965829","326965828","326965831","326965832","326965835","326965834","326965838","326965837","326965841","326965840","326965845","326965843","326965846","326965850","326965849","326965847","326965854","326965858","326965852","326965851","326965856","326965859","326965857","326965860","326965863","326965864","326965868","326965869","326965875","326965874","326965872","326965877","326965879","326965873","326965876","326965881","326965880","326965888","326965883","326965882","326965887","326965884","326965893","326965895","326965897","326965889","326965894","326965891","326965899","326965901","326965896","326965892","326965900","326965902","326965905","326965907","326965906","326965909","326965910","326965912","326965913","326965914","326965916","326965917","326965918","326965919","326965921","326965922","326965926","326965927","326965929","326965930","326965931","326965932","326965935","326965933","326965936","326965937","326965938","326965939","326965940","326965942","326965944","326965943","326965945","326965946","326965947","326965949","326965950","326965952","326965953","326965956","326965955","326965957","326965971","326965974","326965973","326965981","326965982","326965987","326965988","326965992","326966008","326966019","326966031","326966034","326966039","326966055","326966056","326966088","326966099","326966119","326966125","326966139","326966151","326966173","326966180","326966217","326966242","326966249","326966260","326966270","326966277","326966284","326966285","326966289","326966293","326966298","326966303","326966304","326966307","326966316","326966323","326966327","326966337","326966357","326966361","326966370","326966369","326966387","326966419","326966429","326966431","326966461","326966462","326966513","326966542","326966543","326966576","326966584","326966593","326966601","326966605","326966614","326966634","326966654","326966687","326966690","326966695","326966719","326966728","326966750","326966753","326966752","326966754","326966756","326966766","326966800","326966822","326966827","326966831","326966892","326966895","326966910","326966928","326966942","326966982","326966984","326966986","326966987","326966992","326966993","326966994","326967052","326967053","326967158","326967170","326967240","326967294","326967327","326967344","326967354","326967357","326967361","326967363","326967366","326967449","326967453","326967458","326967470","326967491","326967496","326967528","326967569","326967573","326967574","326967584","326967585","326967588","326967599","326967600","326967620","326967630","326967671","326967694","326967703","326967705","326967713","326967748","326967750","326967752","326967754","326967759","326967762","326967761","326967801","326967810","326967819","326967822","326967853","326967868","326967893","326967897","326967986","326967987","326968055","326968071","326968132","326968134","326968133","326968145","326968147","326968207","326968216","326968217","326968221","326968226","326968270","326968280","326968302","326968350","326968401","326968447","326968514","326968526","326968562","326968559","326968560","326968568","326968572","326968571","326968574","326968573","326968577","326968576","326968597","326968621","326968627","326968642","326968643","326968647","326968648","326968664","326968682","326968714","326968718","326968727","326968754","326968765","326968778","326968795","326968807","326968808","326968809","326968810","326968812","326968815","326968819","326968821","326968822","326968823","326968824","326968828","326968830","326968833","326968839","326968845","326968849","326968848","326968851","326968853","326968852","326968885","326968905","326968927","326968940","326968945","326968954","326968956","326968971","326968972","326968975","326968978","326968985","326969004","326969025","326969038","326969040","326969042","326969041"]}})

       

       

      see this pic, two query's command/planSummary/ are same, but why docsExamined different?  

       

        1. 1.bmp
          1.01 MB
          Fallen N/A

            Assignee:
            rhea.thorne@mongodb.com Alison Rhea Thorne
            Reporter:
            595500783@qq.com Fallen N/A
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: