db.XXX.find returns no documents but db.XXX.count return document rows under mongodb sharding

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In mongodb version v3.4.12, db.XXX.find returns no documents but db.XXX.count return document count under mongodb sharding. Any idea! Thanks!

      mongos> db['live-hls'].find({fileType:"0","$or":[{"isDelete":{"$exists":false}},{"isDelete":false}],expireDate:{$gt:0,$lt:1532361663004}}) 
      mongos> db['live-hls'].count({fileType:"0","$or":[{"isDelete":{"$exists":false}},{"isDelete":false}],expireDate:{$gt:0,$lt:1532361663004}}) 
      1077 
      mongos> db['live-hls'].find({fileType:"0","$or":[{"isDelete":{"$exists":false}},{"isDelete":false}],expireDate:{$gt:0,$lt:1532361663004}})
      mongos> db['live-hls'].find({fileType:"0","$or":[{"isDelete":{"$exists":false}},{"isDelete":false}],expireDate:{$gt:0,$lt:1532361663004}}).count()
      1077
      mongos> db['live-hls'].find({fileType:"0",expireDate:{$gt:0,$lt:1532361663004}}).count()
      1077
      mongos> db['live-hls'].find({fileType:"0",expireDate:{$lt:1532361663004}}).count()
      1077
      
      mongos> sh.status()
      --- Sharding Status --- 
        sharding version: {
              "_id" : 1,
              "minCompatibleVersion" : 5,
              "currentVersion" : 6,
              "clusterId" : ObjectId("587f6bc3d995eccd9ab9b1ac")
        }
        shards:
              {  "_id" : "shard1",  "host" : "shard1/10.23.135.140:17089,10.23.135.141:17089,10.23.135.142:17089",  "state" : 1 }
              {  "_id" : "shard2",  "host" : "shard2/10.23.135.140:17090,10.23.135.141:17090,10.23.135.142:17090",  "state" : 1 }
              {  "_id" : "shard3",  "host" : "shard3/10.23.135.140:17091,10.23.135.141:17091,10.23.135.142:17091",  "state" : 1 }
              {  "_id" : "shard4",  "host" : "shard4/10.23.135.140:17092,10.23.135.141:17092,10.23.135.142:17092",  "state" : 1 }
              {  "_id" : "shard5",  "host" : "shard5/10.23.135.140:17093,10.23.135.141:17093,10.23.135.142:17093",  "state" : 1 }
              {  "_id" : "shard6",  "host" : "shard6/10.23.135.140:17094,10.23.135.141:17094,10.23.135.142:17094",  "state" : 1 }
              {  "_id" : "shard7",  "host" : "shard7/10.23.135.140:17095,10.23.135.141:17095,10.23.135.142:17095",  "state" : 1 }
        active mongoses:
              "3.4.12" : 4
        autosplit:
              Currently enabled: yes
        balancer:
              Currently enabled:  yes
              Currently running:  no
      NaN
                      Balancer active window is set between 6:00 and 18:00 server local time
              Failed balancer rounds in last 5 attempts:  0
              Migration Results for the last 24 hours: 
                      No recent migrations
        databases:
      

            Assignee:
            Nick Brewer (Inactive)
            Reporter:
            Jianfeng Xu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: