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

_id index should not be allowed to have partial filter or be sparse

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.1.3
    • Affects Version/s: 3.1.1
    • Component/s: Index Maintenance
    • Minor Change
    • ALL
    • Hide
          coll=db.id_partial;
          coll.drop();
          db.createCollection("id_partial", {autoIndexId: false});
          coll.ensureIndex({_id: 1}, {filter: {a: 1}});
          coll.insert({a:2});
          printjson(coll.getIndexSpecs());
          printjson(coll.validate.keysPerIndex);
      
      Show
      coll=db.id_partial; coll.drop(); db.createCollection( "id_partial" , {autoIndexId: false }); coll.ensureIndex({_id: 1}, {filter: {a: 1}}); coll.insert({a:2}); printjson(coll.getIndexSpecs()); printjson(coll.validate.keysPerIndex);
    • Quint Iteration 3

      If you create a collection without the _id index, you can create a partial index on _id.

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

              Created:
              Updated:
              Resolved: