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

Add multi{point, line, polygon} and geometrycollection GeoJSON types to 2dsphere index.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.4.0-rc1
    • Fix Version/s: 2.5.1
    • Component/s: Geo, Querying
    • Labels:
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      See code above.

      Show
      See code above.

      Description

      The release notes for the new '2dsphere' index does not indicate if indexing arrays of GeoJSON objects is supported.

      It was supported for the '2d' index so I expected it to be supported for the '2dsphere' indexes but I tried it with 2.4.0_rc1 and it returned a "malformed geometry" error:

      > db.system.indexes.find();
      { "v" : 1, "key" : { "_id" : 1 }, "ns" : "acceptance_test.geo_2", "name" : "_id_" }
      { "v" : 1, "key" : { "p" : "2dsphere" }, "ns" : "acceptance_test.geo_2", "name" : "p_2dsphere" }
      > db.geo_2.insert( { "p" : [ { "type" : "Point", "coordinates" : [ 87.9259315145841, 63.65550362431469 ] }, { "type" : "Point", "coordinates" : [ 88.9259315145841, 64.65550362431469 ] } ] } )
      Can't extract geo keys from object, malformed geometry?:{ 0: { type: "Point", coordinates: [ 87.92593151458409, 63.65550362431469 ] }, 1: { type: "Point", coordinates: [ 88.92593151458409, 64.65550362431469 ] } }

      I can understand not supporting indexing arrays of GeoJSON documents but it should be documented in the release notes at a minimum.

      For grins I also tried the GeometryCollection:

      > db.geo_2.insert( { "p" : { "type": "GeometryCollection", "geometries": [ { "type" : "Point", "coordinates" : [ 87.9259315145841, 63.65550362431469 ] }, { "type" : "Point", "coordinates" : [ 88.9259315145841, 64.65550362431469 ] } ] } } )
      Can't extract geo keys from object, malformed geometry?:{ type: "GeometryCollection", geometries: [ { type: "Point", coordinates: [ 87.92593151458409, 63.65550362431469 ] }, { type: "Point", coordinates: [ 88.92593151458409, 64.65550362431469 ] } ] }

      ... and MultiPoint but neither worked.

      > db.geo_2.insert( { "p" : { "type" : "MultiPoint", "coordinates" : [ [ 87.9259315145841, 63.65550362431469 ] , [ 88.9259315145841, 64.65550362431469 ] ] } } )
      Can't extract geo keys from object, malformed geometry?:{ type: "MultiPoint", coordinates: [ [ 87.92593151458409, 63.65550362431469 ], [ 88.92593151458409, 64.65550362431469 ] ] }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                13 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: