Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SERVER-7957 use intuitive bson array building method

  • Loading branch information...
commit e08e3c4b635b0517d9d380c5a974787c8e9632ca 1 parent 59f0762
Hari Khalsa authored
View
6 jstests/geo_s2near.js
@@ -2,6 +2,12 @@
t = db.geo_s2near
t.drop();
+// Make sure that geoNear gives us back loc
+goldenPoint = {type: "Point", coordinates: [ 31.0, 41.0]}
+t.insert({geo: goldenPoint})
+t.ensureIndex({ geo : "2dsphere" })
+resNear = db.runCommand({geoNear : t.getName(), near: [30, 40], num: 1, includeLocs: true})
+assert.eq(resNear.results[0].loc, goldenPoint)
// FYI:
// One degree of long @ 0 is 111km or so.
View
2  src/mongo/db/geo/s2index.cpp
@@ -455,7 +455,7 @@ namespace mongo {
for (BSONElementSet::iterator oi = geoFieldElements.begin();
oi != geoFieldElements.end(); ++oi) {
if (oi->isABSONObj()) {
- oneResultBuilder.append("loc", oi->Obj());
+ oneResultBuilder.appendAs(*oi, "loc");
}
}
}
View
1  src/mongo/db/geo/s2nearcursor.cpp
@@ -155,6 +155,7 @@ namespace mongo {
verify(_results.empty());
if (_innerRadius >= _outerRadius) { return; }
if (_innerRadius > _maxDistance) { return; }
+ if (0 == _numToReturn) { return; }
// We iterate until 1. our search radius is too big or 2. we find results.
do {
Please sign in to comment.
Something went wrong with that request. Please try again.