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

2dsphere index appears to allow indexing of parallel arrays

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.6
    • Component/s: Geo, Index Maintenance
    • None
    • Fully Compatible
    • ALL
    • Hide

      ----- OPERATING AS EXPECTED:

      db.t.drop()
      
      db.t.ensureIndex({
          "keywords": 1,
          "hashtags": 1
      })
      
      db.t.insert({
          "_id": 1,
          "text": "This is a test of the emergency broadcast system. #fail #zoolander #yahoo",
          "keywords": [ "test", "emergency", "broadcast", "system", "fail", "zoolander", "yahoo" ],
          "hashtags": [ "fail", "zoolander", "yahoo" ],
          "language": "en",
          "geojson": {
              "type": "Point",
              "coordinates": [ -123.14489, 49.30452 ]
          },
      })
      

      ----- OPERATING IN A SURPRISING WAY:

      db.t.drop()
      
      db.t.ensureIndex({
          "geojson": "2dsphere", // this is the only difference
          "keywords": 1,
          "hashtags": 1
      })
      
      db.t.insert({
          "_id": 1,
          "text": "This is a test of the emergency broadcast system. #fail #zoolander #yahoo",
          "keywords": [ "test", "emergency", "broadcast", "system", "fail", "zoolander", "yahoo" ],
          "hashtags": [ "fail", "zoolander", "yahoo" ],
          "language": "en",
          "geojson": {
              "type": "Point",
              "coordinates": [ -123.14489, 49.30452 ]
          },
      })
      
      Show
      ----- OPERATING AS EXPECTED: db.t.drop() db.t.ensureIndex({ "keywords": 1, "hashtags": 1 }) db.t.insert({ "_id": 1, "text": "This is a test of the emergency broadcast system. #fail #zoolander #yahoo", "keywords": [ "test", "emergency", "broadcast", "system", "fail", "zoolander", "yahoo" ], "hashtags": [ "fail", "zoolander", "yahoo" ], "language": "en", "geojson": { "type": "Point", "coordinates": [ -123.14489, 49.30452 ] }, }) ----- OPERATING IN A SURPRISING WAY: db.t.drop() db.t.ensureIndex({ "geojson": "2dsphere", // this is the only difference "keywords": 1, "hashtags": 1 }) db.t.insert({ "_id": 1, "text": "This is a test of the emergency broadcast system. #fail #zoolander #yahoo", "keywords": [ "test", "emergency", "broadcast", "system", "fail", "zoolander", "yahoo" ], "hashtags": [ "fail", "zoolander", "yahoo" ], "language": "en", "geojson": { "type": "Point", "coordinates": [ -123.14489, 49.30452 ] }, })

      If I try to index two fields that are arrays without the presence of a 2dsphere index, when I try to insert a document, I predictably get the errmsg "insertDocument :: caused by :: 10088 cannot index parallel arrays [field1] [field2]".

      If I create the index with a 2dsphere in it, it allows such insertions, and it appears that it even uses the index in the query plan!

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            pbryan Paul Bryan
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: