{
  "id": "shardsidreader",
  "title": "ShardsIDReader",
  "url": "https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/deprecated-features/gears-v1/jvm/classes/readers/shardsidreader/",
  "summary": "Gets the shard ID for each shard in a database.",
  "tags": [
    "docs",
    "operate",
    "stack"
  ],
  "last_updated": "2026-04-22T11:55:45+02:00",
  "page_type": "content",
  "content_hash": "501e30a16238da80be58f3cbc9e7ac11cc3f8981b39f33b949a7248de42d1634",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "The `ShardsIDReader` creates a single record on each shard that represents the current shard's ID.\n \nUse this reader when you want to run an operation on each shard in the database."
    },
    {
      "id": "parameters",
      "title": "Parameters",
      "role": "parameters",
      "text": "None"
    },
    {
      "id": "output-records",
      "title": "Output records",
      "role": "returns",
      "text": "Creates a record for each shard with the shard's cluster identifier."
    },
    {
      "id": "example",
      "title": "Example",
      "role": "example",
      "text": "[code example]"
    }
  ],
  "examples": [
    {
      "id": "example-ex0",
      "language": "java",
      "code": "ShardsIDReader reader = new ShardsIDReader();",
      "section_id": "example"
    }
  ]
}
