forked from mongodb/mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check spherical earth query bounds SERVER-2980
- Loading branch information
gregs
committed
May 6, 2011
1 parent
be12400
commit aa13eda
Showing
3 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Ensures spherical queries report invalid latitude values in points and center positions | ||
// | ||
|
||
t = db.geooobsphere | ||
t.drop(); | ||
|
||
t.insert({ loc : { x : 30, y : 89 } }) | ||
t.insert({ loc : { x : 30, y : 89 } }) | ||
t.insert({ loc : { x : 30, y : 89 } }) | ||
t.insert({ loc : { x : 30, y : 89 } }) | ||
t.insert({ loc : { x : 30, y : 89 } }) | ||
t.insert({ loc : { x : 30, y : 89 } }) | ||
t.insert({ loc : { x : 30, y : 91 } }) | ||
|
||
t.ensureIndex({ loc : "2d" }) | ||
assert.isnull( db.getLastError() ) | ||
|
||
t.find({ loc : { $nearSphere : [ 30, 91 ], $maxDistance : 0.25 } }).count() | ||
var err = db.getLastError() | ||
assert( err != null ) | ||
printjson( err ) | ||
|
||
t.find({ loc : { $nearSphere : [ 30, 89 ], $maxDistance : 0.25 } }).count() | ||
var err = db.getLastError() | ||
assert( err != null ) | ||
printjson( err ) | ||
|
||
t.find({ loc : { $within : { $centerSphere : [[ -180, -91 ], 0.25] } } }).count() | ||
var err = db.getLastError() | ||
assert( err != null ) | ||
printjson( err ) | ||
|
||
db.runCommand({ geoNear : "geooobsphere", near : [179, -91], maxDistance : 0.25, spherical : true }) | ||
var err = db.getLastError() | ||
assert( err != null ) | ||
printjson( err ) | ||
|
||
db.runCommand({ geoNear : "geooobsphere", near : [30, 89], maxDistance : 0.25, spherical : true }) | ||
var err = db.getLastError() | ||
assert( err != null ) | ||
printjson( err ) |