Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1221

GeoWithinBox doesn't contain enough parameters

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0
    • Affects Version/s: 2.0
    • Component/s: API
    • Labels:

      FieldDefinitionBuilder.GeoWithinBox methods have only 2 parameters for bounding box coordinates - x and y. It is impossible to add second corner coordinates.

      Calling method creates query like this:

      Bad query
      "$query" : {
              "Location" : {
                      "$geoWithin" : {
                              "$box" : [
                                      16.9,
                                      52.38
                              ]
                      }
              }
      }
      

      It results in throwing an exception by mongod:

      "exception" : "Can't canonicalize query: BadValue bad geo query: { $geoWithin: { $box: [ 16.9, 52.38 ] } }",
      "exceptionCode" : 17287,
      

      According to DB documentation, $box should contain two pairs of coordinates, eg.

      { $box:  [ [ 0, 0 ], [ 100, 100 ] ] }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            Keraxel Kamil Cie?lak [X]
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: