Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17915

Partial indexes should not be allowed as shard key

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.3
    • Affects Version/s: 3.1.1
    • Component/s: Index Maintenance
    • Labels:
    • Fully Compatible
    • ALL
    • Hide
          var st = new ShardingTest({ shards: 2 }); 
      
          var testDB = st.s.getDB('test');
          testDB.dropDatabase();
          var testCol = testDB.getCollection('partialTest');
      
          testCol.ensureIndex({a:1},{b:{$exists:1}});
          testDB.adminCommand({ enablesharding: 'test' }); 
          assert.commandFailed(testDB.adminCommand({ shardcollection: 'test.partialTest', key: { a : 1 }}));
      
      Show
      var st = new ShardingTest({ shards: 2 }); var testDB = st.s.getDB( 'test' ); testDB.dropDatabase(); var testCol = testDB.getCollection( 'partialTest' ); testCol.ensureIndex({a:1},{b:{$exists:1}}); testDB.adminCommand({ enablesharding: 'test' }); assert .commandFailed(testDB.adminCommand({ shardcollection: 'test.partialTest' , key: { a : 1 }}));
    • Quint Iteration 3.1.2, Quint Iteration 3

      Partial indexes shouldn't be allowed to be used as the shard key.

            Assignee:
            rassi J Rassi
            Reporter:
            michael.grundy Michael Grundy
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: