'In version 5.0.2, multiple shards have the same tag. What allocation strategy determines which shard data is written to first?

{  "_id" : "shard_1",  "host" : "xxx,xxx,xxx",  "state" : 1,  "topologyTime" : Timestamp(1629874907, 2),  "tags" : [ "TAG1" ],  "maxSize" : 2736012 }
{  "_id" : "shard_2",  "host" : "xxx,xxx,xxx",  "state" : 1,  "topologyTime" : Timestamp(1629874910, 1),  "tags" : [ "TAG1" ],  "maxSize" : 2736012 }
{  "_id" : "shard_3",  "host" : "xxx,xxx,xxx",  "state" : 1,  "topologyTime" : Timestamp(1629874912, 2),  "tags" : [ "TAG1" ],  "maxSize" : 2736012 }
chunks:
      shard_1   215771
      shard_2   218385
      shard_3   375607
active mongoses:
        "5.0.2" : 3
  autosplit:
        Currently enabled: yes
  balancer:
        Currently enabled: yes
        Currently running: yes

new data is always written shard_3,I would like to know why this happens, thanks!!!!!!!!!!!!!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source