diff options
Diffstat (limited to 'jstests/aggregation/sources/geonear/requires_geo_index.js')
-rw-r--r-- | jstests/aggregation/sources/geonear/requires_geo_index.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/jstests/aggregation/sources/geonear/requires_geo_index.js b/jstests/aggregation/sources/geonear/requires_geo_index.js index e2c3a1d9706..f8380eb27a4 100644 --- a/jstests/aggregation/sources/geonear/requires_geo_index.js +++ b/jstests/aggregation/sources/geonear/requires_geo_index.js @@ -2,21 +2,21 @@ // TODO: Reenable test on passthroughs with sharded collections as part of SERVER-38995. // @tags: [assumes_unsharded_collection] (function() { - "use strict"; +"use strict"; - load("jstests/aggregation/extras/utils.js"); // For "assertErrorCode". +load("jstests/aggregation/extras/utils.js"); // For "assertErrorCode". - const coll = db.coll; - const from = db.from; +const coll = db.coll; +const from = db.from; - coll.drop(); - from.drop(); +coll.drop(); +from.drop(); - const geonearPipeline = [ - {$geoNear: {near: [0, 0], distanceField: "distance", spherical: true}}, - ]; +const geonearPipeline = [ + {$geoNear: {near: [0, 0], distanceField: "distance", spherical: true}}, +]; - const geonearWithinLookupPipeline = [ +const geonearWithinLookupPipeline = [ { $lookup: { pipeline: geonearPipeline, @@ -26,16 +26,16 @@ }, ]; - assert.commandWorked(coll.insert({_id: 5, x: 5})); - assert.commandWorked(from.insert({_id: 1, geo: [0, 0]})); +assert.commandWorked(coll.insert({_id: 5, x: 5})); +assert.commandWorked(from.insert({_id: 1, geo: [0, 0]})); - // Fail without index. - assertErrorCode(from, geonearPipeline, ErrorCodes.IndexNotFound); - assertErrorCode(coll, geonearWithinLookupPipeline, ErrorCodes.IndexNotFound); +// Fail without index. +assertErrorCode(from, geonearPipeline, ErrorCodes.IndexNotFound); +assertErrorCode(coll, geonearWithinLookupPipeline, ErrorCodes.IndexNotFound); - assert.commandWorked(from.createIndex({geo: "2dsphere"})); +assert.commandWorked(from.createIndex({geo: "2dsphere"})); - // Run successfully when you have the geospatial index. - assert.eq(from.aggregate(geonearPipeline).itcount(), 1); - assert.eq(coll.aggregate(geonearWithinLookupPipeline).itcount(), 1); +// Run successfully when you have the geospatial index. +assert.eq(from.aggregate(geonearPipeline).itcount(), 1); +assert.eq(coll.aggregate(geonearWithinLookupPipeline).itcount(), 1); }()); |