Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-592

shardcollection synax is incorrect

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • Server_Docs_20231030
    • None
    • manual
    • None

    Description

      http://docs.mongodb.org/manual/reference/command/shardCollection/

      command syntax is list as

      { shardcollection: "<db>.<collection>", key: "<shardkey>" }

      however

      key :

      { "<shardkey>" : 1 }

      is correct syntax

      mongos> db.runCommand(

      {shardcollection: "test.bar2" , key : "key"}

      )

      { "ok" : 0, "errmsg" : "no shard key" }

      mongos> db.runCommand({shardcollection: "test.bar2" , key :

      { "key": 1}

      })

      { "collectionsharded" : "test.bar2", "ok" : 1 }

      mongos>

      Attachments

        Activity

          People

            sam.kleinman Sam Kleinman (Inactive)
            gregor Gregor Macadam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11 years, 19 weeks, 1 day ago