summaryrefslogtreecommitdiff
path: root/jstests/core/geo_borders.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/geo_borders.js')
-rw-r--r--jstests/core/geo_borders.js134
1 files changed, 64 insertions, 70 deletions
diff --git a/jstests/core/geo_borders.js b/jstests/core/geo_borders.js
index f0a47339591..f8a94d997dd 100644
--- a/jstests/core/geo_borders.js
+++ b/jstests/core/geo_borders.js
@@ -33,81 +33,75 @@ assert.commandWorked(res);
// ************
// If the bounds are bigger than the box itself, just clip at the borders
-assert.eq(numItems,
- t.find({
- loc: {
- $within: {
- $box: [
- [overallMin - 2 * epsilon, overallMin - 2 * epsilon],
- [overallMax + 2 * epsilon, overallMax + 2 * epsilon]
- ]
- }
- }
- }).count());
+assert.eq(numItems, t.find({
+ loc: {
+ $within: {
+ $box: [
+ [overallMin - 2 * epsilon, overallMin - 2 * epsilon],
+ [overallMax + 2 * epsilon, overallMax + 2 * epsilon]
+ ]
+ }
+ }
+ }).count());
// Check this works also for bounds where only a single dimension is off-bounds
-assert.eq(numItems - 5,
- t.find({
- loc: {
- $within: {
- $box: [
- [overallMin - 2 * epsilon, overallMin - 0.5 * epsilon],
- [overallMax - epsilon, overallMax - epsilon]
- ]
- }
- }
- }).count());
+assert.eq(numItems - 5, t.find({
+ loc: {
+ $within: {
+ $box: [
+ [overallMin - 2 * epsilon, overallMin - 0.5 * epsilon],
+ [overallMax - epsilon, overallMax - epsilon]
+ ]
+ }
+ }
+ }).count());
// Make sure we can get at least close to the bounds of the index
-assert.eq(numItems,
- t.find({
- loc: {
- $within: {
- $box: [
- [overallMin - epsilon / 2, overallMin - epsilon / 2],
- [overallMax + epsilon / 2, overallMax + epsilon / 2]
- ]
- }
- }
- }).count());
+assert.eq(numItems, t.find({
+ loc: {
+ $within: {
+ $box: [
+ [overallMin - epsilon / 2, overallMin - epsilon / 2],
+ [overallMax + epsilon / 2, overallMax + epsilon / 2]
+ ]
+ }
+ }
+ }).count());
// Make sure we can get at least close to the bounds of the index
-assert.eq(numItems,
- t.find({
- loc: {
- $within: {
- $box: [
- [overallMax + epsilon / 2, overallMax + epsilon / 2],
- [overallMin - epsilon / 2, overallMin - epsilon / 2]
- ]
- }
- }
- }).count());
+assert.eq(numItems, t.find({
+ loc: {
+ $within: {
+ $box: [
+ [overallMax + epsilon / 2, overallMax + epsilon / 2],
+ [overallMin - epsilon / 2, overallMin - epsilon / 2]
+ ]
+ }
+ }
+ }).count());
// Check that swapping min/max has good behavior
-assert.eq(numItems,
- t.find({
- loc: {
- $within: {
- $box: [
- [overallMax + epsilon / 2, overallMax + epsilon / 2],
- [overallMin - epsilon / 2, overallMin - epsilon / 2]
- ]
- }
- }
- }).count());
-
-assert.eq(numItems,
- t.find({
- loc: {
- $within: {
- $box: [
- [overallMax + epsilon / 2, overallMin - epsilon / 2],
- [overallMin - epsilon / 2, overallMax + epsilon / 2]
- ]
- }
- }
- }).count());
+assert.eq(numItems, t.find({
+ loc: {
+ $within: {
+ $box: [
+ [overallMax + epsilon / 2, overallMax + epsilon / 2],
+ [overallMin - epsilon / 2, overallMin - epsilon / 2]
+ ]
+ }
+ }
+ }).count());
+
+assert.eq(numItems, t.find({
+ loc: {
+ $within: {
+ $box: [
+ [overallMax + epsilon / 2, overallMin - epsilon / 2],
+ [overallMin - epsilon / 2, overallMax + epsilon / 2]
+ ]
+ }
+ }
+ }).count());
// **************
// Circle tests
@@ -206,6 +200,6 @@ assert.commandWorked(db.runCommand({geoNear: "borders", near: onBounds}));
// Make sure we can get all nearby points within one step (4 points in top
// corner)
-assert.eq(4,
- db.runCommand({geoNear: "borders", near: offCenter, maxDistance: step * 1.5})
- .results.length);
+assert.eq(
+ 4,
+ db.runCommand({geoNear: "borders", near: offCenter, maxDistance: step * 1.5}).results.length);