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

Can't find by 2dsphere MultiPoint field

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.3.1
    • Component/s: Geo, Querying
    • None
    • ALL
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      I have one document with MultiPoint field. Field has one point inside:

      {
          "_id" : ObjectId("56e7e24cb1b31934cdce1a0e"),
          "geo_segments" : {
              "type" : "MultiPoint",
              "coordinates" : [ 
                  [ 
                      42.64248, 
                      42.64248
                  ]
              ]
          }
      }
      

      I nserted it like that:

      db.test.insert({    "geo_segments" : {
              "type" : "MultiPoint",
              "coordinates" : [ 
                  [ 
                      42.64248, 
                      42.64248
                  ]
              ]
          }})
      

      Field is indexed with 2dsphere index:

      db.test.ensureIndex({"geo_segments": "2dsphere"})
      

      When I run find() with the bounding window (counter clock-wise region:

      db.test.find({
          "geo_segments": {
            $geoWithin: {
              $geometry: {
                type : "Polygon" ,
                coordinates: [[[-38.0, 40.0], [97.0, 40.0], [97.0, 50.0], [-38.0, 50.0],[-38.0, 40.0]]]
              }
            }
          }
      })
      

      nothing is found.

      I have even try it with CRS without result:

      db.test.find({
          "geo_segments": {
            $geoWithin: {
              $geometry: {
                type : "Polygon" ,
                coordinates: [[[-38.0, 40.0], [97.0, 40.0], [97.0, 50.0], [-38.0, 50.0],[-38.0, 40.0]]],
                "crs": {
                    type:"name",
                    properties: {
                        name: "urn:x-mongodb:crs:strictwinding:EPSG:4326"
                    }
                }
              }
            }
          }
      })
      

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            odiszapc Alexey Plotnik
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: