title: Mongodb geo-spatial query not reporting an error on spherical wrapping, but returning a weird result
body: <p>I have a weird behavior when querying geospatial data.</p>
  
  <p>From the <a href="http://www.mongodb.org/display/DOCS/Geospatial+Indexing" rel="nofollow">doc</a>:</p>
  
  <blockquote>
    <p>We don't currently handle wrapping at the poles or at the transition
    from -180° to +180° longitude, however we detect when a search would
    wrap and raise an error.</p>
  </blockquote>
  
  <p>However I have one object at <code>[179,0]</code> and if I query for objects near <code>[-179,0]</code> with a max distance of 0.9, the object is returned and the computed distance is 2 degrees. No error is raised.</p>
  
  <p>If I query for the same location, but with a max distance of 1.0 the object is not returned and still no error.</p>
  
  <p>Is this a bug or do I miss something? I could not find any reported bug about that on jira.</p>
  
  <pre><code>PRIMARY&gt; version()
  version: 2.0.7
  PRIMARY&gt; db.runCommand({geoNear:"GeoBug",near:[-179,0],spherical:true,maxDistance:1.0})
  {
    "ns" : "mydb.GeoBug",
    "near" : "0100000000000000100010100010100000000000100010100010",
    "results" : [
      {
        "dis" : 0.03490658503988567, (2 degrees)
        "obj" : {
          "_id" : ObjectId("5098e71b744eca2df1b325f2"),
          "location" : {
            "lonlat" : [
              179,
              0
            ]
          }
        }
      }
    ],
    "stats" : {
      "time" : 0,
      "btreelocs" : 0,
      "nscanned" : 2,
      "objectsLoaded" : 1,
      "avgDistance" : 0.03490658503988567,
      "maxDistance" : 0.03490689563235392
    },
    "ok" : 1
  }
  PRIMARY&gt; db.runCommand({geoNear:"GeoBug",near:[-179,0],spherical:true,maxDistance:0.9})
  {
    "ns" : "mydb.GeoBug",
    "near" : "0100000000000000100010100010100000000000100010100010",
    "results" : [ ],
    "stats" : {
      "time" : 0,
      "btreelocs" : 0,
      "nscanned" : 1,
      "objectsLoaded" : 0,
      "avgDistance" : NaN,
      "maxDistance" : 0
    },
    "ok" : 1
  }
  </code></pre>