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

IndexCatalog should forbid creation of index with multiple special types

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.0-rc3
    • Affects Version/s: 2.6.0-rc2
    • Component/s: Index Maintenance
    • Labels:
      None
    • ALL

      It is possible to make a compound index in which the first field is "2d" and the second is "text":

      > db.coll.ensureIndex({a: "2d", b: "text"})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      

      Other special index types disallow this, for example "2dsphere":

      > db.coll.ensureIndex({a: "2dsphere", b: "text"})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"errmsg" : "exception: Cannot use 2dsphere index with other special index types: b: \"text\"",
      	"code" : 16823,
      	"ok" : 0
      }
      

      We may want to do the same validation for "2d" that we do for "2dsphere".

            Assignee:
            rassi J Rassi
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: