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

wrong distance calcul when GeoNear used with aggregate

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.6.6
    • Fix Version/s: None
    • Component/s: Aggregation Framework, Geo
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      this distance query output without aggregation is correct :
      QUERY A

      db.runCommand( {      
          geoNear: "tablegui",
          near: [2.298800, 48.854355], 
          maxDistance:20000000/6371 ,
          distanceMultiplier: 6371 ,   
          spherical: true,   
          query: { code_postal : { $gt : 30000 }     } ,
          limit:500}
               );

      This one with aggregation is not :
      QUERY B

      db.tablegui.aggregate([
       
         {
           $geoNear: {
              near: { type: "Point", coordinates: [2.298800, 48.854355] },
              distanceField: "dist.calculated",
              distanceMultiplier: 6371 ,     
              maxDistance:20000000/6371 ,
              query: { code_postal:  { $gt : 30000 }   },
             limit:20000,   
             spherical: true 
           }
         }
       
          , { $project : { _id : 0  , ville : 1 , code_postal:1 , "dist.calculated":1  } } 
       
      ]
         
        
       )

      Show
      this distance query output without aggregation is correct : QUERY A db.runCommand( { geoNear: "tablegui", near: [2.298800, 48.854355], maxDistance:20000000/6371 , distanceMultiplier: 6371 , spherical: true, query: { code_postal : { $gt : 30000 } } , limit:500} ); This one with aggregation is not : QUERY B db.tablegui.aggregate([   { $geoNear: { near: { type: "Point", coordinates: [2.298800, 48.854355] }, distanceField: "dist.calculated", distanceMultiplier: 6371 , maxDistance:20000000/6371 , query: { code_postal: { $gt : 30000 } }, limit:20000, spherical: true } }   , { $project : { _id : 0 , ville : 1 , code_postal:1 , "dist.calculated":1 } }   ] )

      Description

      wrong distance calcul when GeoNear used with aggregate .

      The same Geonear query with same distanceMultiplier
      and maxDistance parameters don't return the same distance calcul output when it 's querying with or without
      aggregation.

      When query A return 1.59861657499673,
      query B return 10196136.37698665

      Divion by 1000 isnot indicate in manual if i didn't miss something..

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              siyuan.zhou Siyuan Zhou
              Reporter:
              pulsar guipulsar
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: