title: Why mongodb query data from removed shards
body: <p>My application query data from removed shards</p>
  
  <p>old cluster: </p>
  
  <ol>
  <li>data shards: set_0(on machine0), set_1(on machine1), set_2(on
  machine2)</li>
  <li>configserver(on machine2)</li>
  <li>mongos(on machine2)</li>
  </ol>
  
  <p>new cluster:</p>
  
  <ol>
  <li><p>data shards: shard_0(on new machine0), shard_1(on new machine1)</p></li>
  <li><p>configserver(on new machine0 and new machine1, they're replset)</p></li>
  <li><p>mongos(on new machine0, new machine1)</p>
  
  <p>Previously, I had three data shards in my mongodb cluster. And I wanted to move the whole cluster to new machines. I did that through adding new data shards into cluster, and remove old data shards from cluster one at a time. </p>
  
  <p>And I moved configserver through adding new configserver to the old configserver replset and changed the primary to secondary and the secondary to primary.</p>
  
  <p>Then I initiate mongos in my new cluster</p>
  
  <p>The whole process went very smoothly. But when my application query some data from new cluster, it sometimes query them from removed shard(set_2), set_2 is a primary shard of my database, but I don't have any unsharded collections in my database any way.(so I don't need use movePrimary method, the removeShard on set2 finished with no fault)</p></li>
  </ol>