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

moveChunk command contains error on find parameter

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • mongodb-2.2
    • manual
    • None

    Description

      On the moveChunk page, the find parameter is explained as

      find – A query expression that will select a document within the chunk you wish to move. The query need not specify the shard key.

      But if I try specifying a find query that does not include the shard key, I get an error:

      mongos> db.adminCommand({moveChunk:"test.docs", find: {a:true}, to: "shard0001"})
      {
      	"errmsg" : "exception: right object ({}) doesn't have full shard key ({ shardkey: 1.0 })",
      	"code" : 10199,
      	"ok" : 0
      }

      Discussing with scotthernandez, this description is wrong. The query must include the shard key.

      Another part that's confusing: The document to match the find query doesn't actually have to exist. The find query just needs to match a potential document that would reside in that shard.

      Attachments

        Activity

          People

            scotthernandez Scott Hernandez (Inactive)
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

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