Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1

Can't presplit on compound index using MaxKey

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      Windows 7, NodeJS
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hello,

      Assuming I have a database: 'boo', with sharding enabled,
      And collection: 'uri', with the compound index:

      {k1:1, k2:1}

      . sharded by key:

      {k1:1, k2:1}

      I want to presplit the collection only using k1. k2 doesn't matter.
      Since the system doesn't allow to split by partial shard key, I read here : http://stackoverflow.com/questions/9516206/pre-split-on-a-compound-shard-key,
      that you can split in the following way:
      db.runCommand( { split : "boo.uri" , middle :

      { k1: 1, k2:MaxKey }

      } );
      db.runCommand( { split : "boo.uri" , middle :

      { k1: 2, k2:MaxKey }

      } );
      db.runCommand( { split : "boo.uri" , middle :

      { k1: 3, k2:MaxKey }

      } );

      This works perfect on the mongo console. but since I'm working with the mongodb client, and I need to send the MaxKey somehow, it fails to work.
      Attached the script I used to test the splitting (after having the db and collection indexed and sharded ready)
      It includes various tries and the response from mongo.

      How can I solve this?
      How do I serialize MaxKey properly and get it to work?

      Thanks in advance

            Assignee:
            cian.sinclair@mongodb.com Cian Sinclair
            Reporter:
            urigolani uri golani
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None