diff options
author | Mihai Andrei <mihai.andrei@10gen.com> | 2020-10-27 10:25:57 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-03 13:30:56 +0000 |
commit | 08c0ec18e804511b96746e87e160bb9c250e5f49 (patch) | |
tree | 0a0ad72c52986a6b27adce8cbf73b3487c28fd82 | |
parent | 787a8b73687a43bbeeea4ea7eeadbf861390253a (diff) | |
download | mongo-08c0ec18e804511b96746e87e160bb9c250e5f49.tar.gz |
SERVER-47081 Delete geoSearch command and related tests
53 files changed, 17 insertions, 783 deletions
diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml index e249b281e6d..281b5850f6d 100644 --- a/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/causally_consistent_hedged_reads_jscore_passthrough.yml @@ -31,7 +31,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml index 858e6a5c996..970e2afaba2 100644 --- a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml @@ -31,7 +31,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml index 04f152ee9f7..d80c4264859 100644 --- a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml +++ b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml @@ -42,7 +42,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml index 7a6b6f722fc..6c47994f682 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_100ms_refresh_jscore_passthrough.yml @@ -24,7 +24,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml index f51b563f0c4..43e392d4758 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_10sec_refresh_jscore_passthrough.yml @@ -24,7 +24,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml index 8bb60d4a7a1..0eaf8d91120 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_1sec_refresh_jscore_passthrough.yml @@ -24,7 +24,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml index 620570f5e78..ddea9e432ff 100644 --- a/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/logical_session_cache_sharding_default_refresh_jscore_passthrough.yml @@ -24,7 +24,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml index 9462279acee..84da723937d 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_local_read_write_multi_stmt_txn_jscore_passthrough.yml @@ -25,7 +25,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml index 49ca369b0b0..fe38c374f14 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_jscore_passthrough.yml @@ -25,7 +25,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml index 78c5d8439cd..4bca862d979 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough.yml @@ -25,7 +25,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml index 9a4d8c03689..58834b14157 100644 --- a/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough.yml @@ -25,7 +25,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml b/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml index 4d4c3ecbd0a..8b3b0da75d2 100644 --- a/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml +++ b/buildscripts/resmokeconfig/suites/multi_stmt_txn_jscore_passthrough_with_migration.yml @@ -25,7 +25,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml index dbeff382792..aaac1b7f82d 100644 --- a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml @@ -27,7 +27,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml index 8131e257a3e..3c8d0d7c6b3 100644 --- a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_read_concern_snapshot_passthrough.yml @@ -27,7 +27,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. - jstests/core/index9.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml index bf04f752de4..3a956aef2ae 100644 --- a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml @@ -26,7 +26,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml index 3ee1ea3bf87..a460c9c269f 100644 --- a/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharded_multi_stmt_txn_jscore_passthrough.yml @@ -22,7 +22,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml index 9ac7fc37e0e..14c91807627 100644 --- a/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml @@ -25,7 +25,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml index f80237f3f24..3824fb333ea 100644 --- a/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml @@ -26,7 +26,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml index bc173209fe0..c908ec4196f 100644 --- a/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharding_update_v1_oplog_jscore_passthrough.yml @@ -25,7 +25,6 @@ selector: - jstests/core/diagdata.js # Command not supported in mongos - jstests/core/dropdb_race.js # syncdelay. - jstests/core/fsync.js # uses fsync. - - jstests/core/geo_haystack*.js # geoSearch. - jstests/core/geo_s2cursorlimitskip.js # profiling. - jstests/core/geo_update_btree2.js # notablescan. - jstests/core/index_id_options.js # "local" database. diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 58ecb710651..80a1a6d99a6 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -1780,11 +1780,11 @@ var authCommandsLib = { { testname: "aggregate_collStats_facet", command: { - aggregate: "foo", + aggregate: "foo", pipeline: [ - {$collStats: {latencyStats: {}}}, + {$collStats: {latencyStats: {}}}, {$facet: {matched: [{$match: {a: 1}}]}} - ], + ], cursor: {} }, setup: function(db) { @@ -1818,16 +1818,16 @@ var authCommandsLib = { { testname: "aggregate_collStats_within_lookup", command: { - aggregate: "foo", + aggregate: "foo", pipeline: [ {$lookup: { - from: "lookupColl", + from: "lookupColl", pipeline: [{ $collStats: {latencyStats: {}} - }], + }], as: "result" - }}, - ], + }}, + ], cursor: {} }, setup: function(db) { @@ -1852,10 +1852,10 @@ var authCommandsLib = { { testname: "aggregate_collStats_within_union", command: { - aggregate: "foo", + aggregate: "foo", pipeline: [ - {$unionWith: {coll: "unionColl", pipeline: [{$collStats: {latencyStats: {}}}]}}, - ], + {$unionWith: {coll: "unionColl", pipeline: [{$collStats: {latencyStats: {}}}]}}, + ], cursor: {} }, setup: function(db) { @@ -3818,31 +3818,6 @@ var authCommandsLib = { ] }, { - testname: "geoSearch", - command: {geoSearch: "x", near: [50, 50], maxDistance: 6, limit: 1, search: {}}, - skipSharded: true, - setup: function(db) { - db.x.drop(); - assert.writeOK(db.x.save({loc: {long: 50, lat: 50}})); - assert.commandWorked(db.x.ensureIndex({loc: "geoHaystack", type: 1}, {bucketSize: 1})); - }, - teardown: function(db) { - db.x.drop(); - }, - testcases: [ - { - runOnDb: firstDbName, - roles: roles_read, - privileges: [{resource: {db: firstDbName, collection: "x"}, actions: ["find"]}] - }, - { - runOnDb: secondDbName, - roles: roles_readAny, - privileges: [{resource: {db: secondDbName, collection: "x"}, actions: ["find"]}] - } - ] - }, - { testname: "getCmdLineOpts", command: {getCmdLineOpts: 1}, testcases: [ diff --git a/jstests/core/commands_namespace_parsing.js b/jstests/core/commands_namespace_parsing.js index 326100542d3..5b001c3f348 100644 --- a/jstests/core/commands_namespace_parsing.js +++ b/jstests/core/commands_namespace_parsing.js @@ -139,15 +139,6 @@ assertFailsWithInvalidNamespacesForField("out.reduce", isNotFullyQualified, isNotAdminCommand); -if (!isMongos) { - // Test geoSearch fails with an invalid collection name. - assertFailsWithInvalidNamespacesForField( - "geoSearch", - {geoSearch: "", search: {}, near: [0.0, 0.0], maxDistance: 10}, - isNotFullyQualified, - isNotAdminCommand); -} - // Test find fails with an invalid collection name. assertFailsWithInvalidNamespacesForField( "find", {find: ""}, isNotFullyQualified, isNotAdminCommand); diff --git a/jstests/core/geo_haystack1.js b/jstests/core/geo_haystack1.js deleted file mode 100644 index 095b0941145..00000000000 --- a/jstests/core/geo_haystack1.js +++ /dev/null @@ -1,64 +0,0 @@ -// @tags: [ -// # Haystack index is not available on embedded -// incompatible_with_embedded, -// ] - -t = db.geo_haystack1; -t.drop(); - -function distance(a, b) { - var x = a[0] - b[0]; - var y = a[1] - b[1]; - return Math.sqrt((x * x) + (y * y)); -} - -function distanceTotal(a, arr, f) { - var total = 0; - for (var i = 0; i < arr.length; i++) { - total += distance(a, arr[i][f]); - } - return total; -} - -queries = [ - {near: [7, 8], maxDistance: 3, search: {z: 3}}, -]; - -answers = queries.map(function() { - return {totalDistance: 0, results: []}; -}); - -n = 0; -for (x = 0; x < 20; x++) { - for (y = 0; y < 20; y++) { - t.insert({_id: n, loc: [x, y], z: n % 5}); - - for (i = 0; i < queries.length; i++) { - var d = distance(queries[i].near, [x, y]); - if (d > queries[i].maxDistance) - continue; - if (queries[i].search.z != n % 5) - continue; - answers[i].results.push({_id: n, loc: [x, y]}); - answers[i].totalDistance += d; - } - - n++; - } -} - -t.ensureIndex({loc: "geoHaystack", z: 1}, {bucketSize: .7}); - -for (i = 0; i < queries.length; i++) { - print("---------"); - printjson(queries[i]); - res = t.runCommand("geoSearch", queries[i]); - print("\t" + tojson(res.stats)); - print("\tshould have: " + answers[i].results.length + "\t actually got: " + res.stats.n); - assert.eq(answers[i].results.length, res.stats.n, "num:" + i + " number matches"); - assert.eq(answers[i].totalDistance, - distanceTotal(queries[i].near, res.results, "loc"), - "num:" + i + " totalDistance"); - // printjson( res ); - // printjson( answers[i].length ); -} diff --git a/jstests/core/geo_haystack2.js b/jstests/core/geo_haystack2.js deleted file mode 100644 index c95e46a4cc7..00000000000 --- a/jstests/core/geo_haystack2.js +++ /dev/null @@ -1,64 +0,0 @@ -// @tags: [ -// # Haystack index is not available on embedded -// incompatible_with_embedded, -// ] - -t = db.geo_haystack2; -t.drop(); - -function distance(a, b) { - var x = a[0] - b[0]; - var y = a[1] - b[1]; - return Math.sqrt((x * x) + (y * y)); -} - -function distanceTotal(a, arr, f) { - var total = 0; - for (var i = 0; i < arr.length; i++) { - total += distance(a, arr[i][f]); - } - return total; -} - -queries = [ - {near: [7, 8], maxDistance: 3, search: {z: 3}}, -]; - -answers = queries.map(function() { - return {totalDistance: 0, results: []}; -}); - -n = 0; -for (x = 0; x < 20; x++) { - for (y = 0; y < 20; y++) { - t.insert({_id: n, loc: [x, y], z: [n % 10, (n + 5) % 10]}); - - for (i = 0; i < queries.length; i++) { - var d = distance(queries[i].near, [x, y]); - if (d > queries[i].maxDistance) - continue; - if (queries[i].search.z != n % 10 && queries[i].search.z != (n + 5) % 10) - continue; - answers[i].results.push({_id: n, loc: [x, y]}); - answers[i].totalDistance += d; - } - - n++; - } -} - -t.ensureIndex({loc: "geoHaystack", z: 1}, {bucketSize: .7}); - -for (i = 0; i < queries.length; i++) { - print("---------"); - printjson(queries[i]); - res = t.runCommand("geoSearch", queries[i]); - print("\t" + tojson(res.stats)); - print("\tshould have: " + answers[i].results.length + "\t actually got: " + res.stats.n); - assert.eq(answers[i].results.length, res.stats.n, "num:" + i + " number matches"); - assert.eq(answers[i].totalDistance, - distanceTotal(queries[i].near, res.results, "loc"), - "num:" + i + " totalDistance"); - // printjson( res ); - // printjson( answers[i].length ); -} diff --git a/jstests/core/geo_haystack3.js b/jstests/core/geo_haystack3.js deleted file mode 100644 index 920a076df17..00000000000 --- a/jstests/core/geo_haystack3.js +++ /dev/null @@ -1,59 +0,0 @@ -// @tags: [ -// # Haystack index is not available on embedded -// incompatible_with_embedded, -// ] - -t = db.geo_haystack3; -t.drop(); - -// -// Tests for geo haystack validity -// - -t.insert({pos: "invalid"}); -assert.commandFailed(t.ensureIndex({pos: "geoHaystack", type: 1}, {bucketSize: 1})); -t.drop(); - -t.insert({pos: []}); -assert.commandFailed(t.ensureIndex({pos: "geoHaystack", type: 1}, {bucketSize: 1})); -t.drop(); - -t.insert({pos: [1, 2]}); -assert.commandWorked(t.ensureIndex({pos: "geoHaystack", type: 1}, {bucketSize: 1})); -t.drop(); - -t.insert({pos: {x: 1, y: 2}}); -assert.commandWorked(t.ensureIndex({pos: "geoHaystack", type: 1}, {bucketSize: 1})); -t.drop(); - -t.insert({pos: {x: 1, y: 2, z: 3}}); -assert.commandWorked(t.ensureIndex({pos: "geoHaystack", type: 1}, {bucketSize: 1})); -t.drop(); - -// -// Tests for geo haystack search -// - -t.insert({pos: {long: 34, lat: 33}}); -t.insert({pos: {long: 34.2, lat: 33.3}, type: ["bar", "restaurant"]}); -t.insert({pos: {long: 34.2, lat: 37.3}, type: ["bar", "chicken"]}); -t.insert({pos: {long: 59.1, lat: 87.2}, type: ["baz", "office"]}); -t.ensureIndex({pos: "geoHaystack", type: 1}, {bucketSize: 1}); - -// This only matches the first insert. What do we want? First 3 or just the first? -res = t.runCommand("geoSearch", {near: [33, 33], maxDistance: 6, search: {}, limit: 30}); -assert.eq(1, res.stats.n, "Right # of matches"); -assert.eq(34, res.results[0].pos.long, "expected longitude"); -assert.eq(33, res.results[0].pos.lat, "expected latitude"); - -// This matches the middle 2 of the 4 elements above. -res = t.runCommand("geoSearch", {near: [33, 33], maxDistance: 6, search: {type: "bar"}, limit: 2}); -assert.eq(2, res.stats.n, "Right # of matches"); -assert.eq("bar", res.results[0].type[0], "expected value for type"); -assert.eq("bar", res.results[1].type[0], "expected value for type"); -assert.neq(res.results[0].type[1], res.results[1].type[1], "should get 2 diff results"); - -// This is a test for the limit being reached/only 1 returned. -res = t.runCommand("geoSearch", {near: [33, 33], maxDistance: 6, search: {type: "bar"}, limit: 1}); -assert.eq(1, res.stats.n, "Right # of matches"); -assert.eq("bar", res.results[0].type[0], "expected value for type"); diff --git a/jstests/core/geo_mindistance_boundaries.js b/jstests/core/geo_mindistance_boundaries.js index 2378176f8ad..9d556b341ac 100644 --- a/jstests/core/geo_mindistance_boundaries.js +++ b/jstests/core/geo_mindistance_boundaries.js @@ -8,7 +8,7 @@ var t = db.geo_mindistance_boundaries; t.drop(); t.insert({loc: [1, 0]}); // 1 degree of longitude from origin. -/* $minDistance is supported for 2dsphere index only, not 2d or geoHaystack. */ +/* $minDistance is supported for 2dsphere index only, not 2d */ t.ensureIndex({loc: "2dsphere"}); // diff --git a/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js b/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js index d1385dc1a19..93d8253ae03 100644 --- a/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js +++ b/jstests/core/txns/commands_banning_txnnumber_outside_transactions.js @@ -35,7 +35,6 @@ const nonRetryableWriteCommands = [ const nonRetryableWriteCommandsMongodOnly = [ // Commands that are allowed in transactions. {coordinateCommitTransaction: 1, participants: []}, - {geoSearch: 1}, {prepareTransaction: 1}, // A selection of commands that are not allowed in transactions. {applyOps: 1} diff --git a/jstests/core/txns/disallow_operations_on_prepared_transaction.js b/jstests/core/txns/disallow_operations_on_prepared_transaction.js index 0e6a8453aa9..5841c085edf 100644 --- a/jstests/core/txns/disallow_operations_on_prepared_transaction.js +++ b/jstests/core/txns/disallow_operations_on_prepared_transaction.js @@ -86,11 +86,6 @@ assert.commandFailedWithCode( }), ErrorCodes.PreparedTransactionInProgress); -jsTestLog("Test that you can't run geoSearch on a prepared transaction."); -assert.commandFailedWithCode( - sessionDB.runCommand({geoSearch: collName, near: [0, 0], search: {a: 1}}), - ErrorCodes.PreparedTransactionInProgress); - jsTestLog("Test that you can't insert on a prepared transaction."); res = assert.commandFailedWithCode(sessionColl.insert({_id: 5}), ErrorCodes.PreparedTransactionInProgress); diff --git a/jstests/core/txns/statement_ids_accepted.js b/jstests/core/txns/statement_ids_accepted.js index e0a6e3a9734..b2c13356df0 100644 --- a/jstests/core/txns/statement_ids_accepted.js +++ b/jstests/core/txns/statement_ids_accepted.js @@ -168,38 +168,6 @@ const isMongos = assert.commandWorked(db.runCommand("hello")).msg === "isdbgrid" if (!isMongos) { // Skip commands that do not exist on mongos. - jsTestLog("Check that geoSearch accepts a statement ID"); - assert.commandWorked(testColl.insert({geo: {type: "Point", coordinates: [0, 0]}, a: 0}), - {writeConcern: {w: "majority"}}); - assert.commandWorked(testColl.insert({geoh: {lat: 0, long: 0}, b: 0}), - {writeConcern: {w: "majority"}}); - assert.commandWorked(sessionDb.runCommand({ - createIndexes: collName, - indexes: [ - {name: "geo", key: {geo: "2dsphere"}}, - {name: "geoh", key: {geoh: "geoHaystack", b: 1}, bucketSize: 1} - ], - writeConcern: {w: "majority"} - })); - // Ensure the snapshot is available following the index creation. - assert.soonNoExcept(function() { - testColl.find({}, {readConcern: {level: "snapshot"}}); - return true; - }); - - jsTestLog("Check that geoSearch accepts a statement ID"); - assert.commandWorked(sessionDb.runCommand({ - geoSearch: collName, - search: {b: 0}, - near: [0, 0], - maxDistance: 1, - readConcern: {level: "snapshot"}, - txnNumber: NumberLong(txnNumber++), - stmtId: NumberInt(0), - startTransaction: true, - autocommit: false - })); - jsTestLog("Check that prepareTransaction accepts a statement ID"); assert.commandWorked(sessionDb.runCommand({ insert: collName, diff --git a/jstests/core/txns/transactions_profiling.js b/jstests/core/txns/transactions_profiling.js index 55f63ab6cfc..455269f439c 100644 --- a/jstests/core/txns/transactions_profiling.js +++ b/jstests/core/txns/transactions_profiling.js @@ -28,11 +28,6 @@ assert.commandWorked(sessionColl.insert({_id: "read-doc"})); assert.commandWorked(sessionColl.insert({_id: "update-doc"})); assert.commandWorked(sessionColl.insert({_id: "multi-update-doc-1"})); assert.commandWorked(sessionColl.insert({_id: "multi-update-doc-2"})); -assert.commandWorked(testDB.runCommand({ - createIndexes: collName, - indexes: [{key: {haystack: "geoHaystack", a: 1}, name: "haystack_geo", bucketSize: 1}], - writeConcern: {w: "majority"} -})); jsTestLog("Test commands that can use shell helpers."); session.startTransaction({readConcern: {level: "snapshot"}, writeConcern: {w: "majority"}}); @@ -97,14 +92,6 @@ assert.eq(profileObj.command.findandmodify, sessionColl.getName(), tojson(profil assert.eq(profileObj.nMatched, 1, tojson(profileObj)); assert.eq(profileObj.nModified, 1, tojson(profileObj)); -jsTestLog("Test geoSearch."); -assert.commandWorked( - sessionDB.runCommand({geoSearch: collName, near: [0, 0], maxDistance: 1, search: {a: 1}})); -profileObj = getLatestProfilerEntry(testDB); -assert.eq(profileObj.op, "command", tojson(profileObj)); -assert.eq(profileObj.ns, sessionColl.getFullName(), tojson(profileObj)); -assert.eq(profileObj.command.geoSearch, sessionColl.getName(), tojson(profileObj)); - jsTestLog("Test getMore."); let res = assert.commandWorked( sessionDB.runCommand({find: collName, filter: {_id: "read-doc"}, batchSize: 0})); diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js index 82d21378f27..7c7e692c95d 100644 --- a/jstests/core/views/views_all_commands.js +++ b/jstests/core/views/views_all_commands.js @@ -270,14 +270,6 @@ let viewsCommandTests = { fsync: {skip: isUnrelated}, fsyncUnlock: {skip: isUnrelated}, getDatabaseVersion: {skip: isUnrelated}, - geoSearch: { - command: { - geoSearch: "view", - search: {}, - near: [-50, 37], - }, - expectFailure: true - }, getCmdLineOpts: {skip: isUnrelated}, getDefaultRWConcern: {skip: isUnrelated}, getDiagnosticData: {skip: isUnrelated}, diff --git a/jstests/libs/override_methods/enable_hedged_reads.js b/jstests/libs/override_methods/enable_hedged_reads.js index f0fbe803291..718bc731644 100644 --- a/jstests/libs/override_methods/enable_hedged_reads.js +++ b/jstests/libs/override_methods/enable_hedged_reads.js @@ -19,7 +19,6 @@ const kCommandsSupportingReadPreference = new Set([ "dbStats", "distinct", "find", - "geoSearch", ]); const kDatabasesOnConfigServers = new Set(["config", "admin"]); diff --git a/jstests/libs/override_methods/read_and_write_concern_helpers.js b/jstests/libs/override_methods/read_and_write_concern_helpers.js index b8102f18a37..d53a0dafad3 100644 --- a/jstests/libs/override_methods/read_and_write_concern_helpers.js +++ b/jstests/libs/override_methods/read_and_write_concern_helpers.js @@ -6,7 +6,6 @@ var kCommandsSupportingReadConcern = new Set([ "count", "distinct", "find", - "geoSearch", ]); /** diff --git a/jstests/libs/override_methods/set_read_preference_secondary.js b/jstests/libs/override_methods/set_read_preference_secondary.js index 9bed1fdad44..9685449103e 100644 --- a/jstests/libs/override_methods/set_read_preference_secondary.js +++ b/jstests/libs/override_methods/set_read_preference_secondary.js @@ -16,7 +16,6 @@ const kCommandsSupportingReadPreference = new Set([ "dbStats", "distinct", "find", - "geoSearch", ]); const kDatabasesOnConfigServers = new Set(["config", "admin"]); diff --git a/jstests/noPassthrough/readConcern_snapshot.js b/jstests/noPassthrough/readConcern_snapshot.js index e151fdb4f1f..36fc65411f4 100644 --- a/jstests/noPassthrough/readConcern_snapshot.js +++ b/jstests/noPassthrough/readConcern_snapshot.js @@ -107,11 +107,6 @@ rst.initiate(); let testDB = rst.getPrimary().getDB(dbName); let coll = testDB.coll; assert.commandWorked(coll.createIndex({geo: "2d"})); -assert.commandWorked(testDB.runCommand({ - createIndexes: collName, - indexes: [{key: {haystack: "geoHaystack", a: 1}, name: "haystack_geo", bucketSize: 1}], - writeConcern: {w: "majority"} -})); // Test snapshot in a transaction. session = testDB.getMongo().startSession({causalConsistency: false}); @@ -134,11 +129,6 @@ assert(!res.cursor.hasOwnProperty("atClusterTime"), tojson(res)); res = assert.commandWorked(sessionDb.runCommand({distinct: collName, key: "x"})); assert(!res.hasOwnProperty("atClusterTime"), tojson(res)); -// readConcern 'snapshot' is supported by geoSearch in a transaction. -res = assert.commandWorked( - sessionDb.runCommand({geoSearch: collName, near: [0, 0], maxDistance: 1, search: {a: 1}})); -assert(!res.hasOwnProperty("atClusterTime"), tojson(res)); - // readConcern 'snapshot' is not supported by non-CRUD commands in a transaction. assert.commandFailedWithCode(sessionDb.runCommand({dropIndexes: collName, index: "a_1"}), ErrorCodes.OperationNotSupportedInTransaction); @@ -168,16 +158,6 @@ res = assert.commandWorked( testDB.runCommand({distinct: collName, key: "x", readConcern: snapshotReadConcern})); assert(res.hasOwnProperty("atClusterTime"), tojson(res)); -// readConcern 'snapshot' is not supported by geoSearch outside of transactions. -assert.commandFailedWithCode(testDB.runCommand({ - geoSearch: collName, - near: [0, 0], - maxDistance: 1, - search: {a: 1}, - readConcern: snapshotReadConcern -}), - ErrorCodes.InvalidOptions); - // readConcern 'snapshot' is not supported by count. assert.commandFailedWithCode(testDB.runCommand({count: collName, readConcern: snapshotReadConcern}), ErrorCodes.InvalidOptions); diff --git a/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js b/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js index fb296a9d29e..a08c3b9f041 100644 --- a/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js +++ b/jstests/noPassthrough/read_concern_snapshot_catalog_invalidation.js @@ -19,10 +19,6 @@ const coll = testDB.getCollection(kCollName); function testCommand(cmd, curOpFilter) { coll.drop({writeConcern: {w: "majority"}}); - assert.commandWorked(testDB.runCommand({ - createIndexes: kCollName, - indexes: [{key: {haystack: "geoHaystack", a: 1}, name: "haystack_geo", bucketSize: 1}] - })); assert.commandWorked(coll.insert({x: 1}, {writeConcern: {w: "majority"}})); // Start a command with readConcern "snapshot" that hangs after establishing a storage @@ -83,8 +79,6 @@ testCommand({findAndModify: kCollName, query: {x: 1}, update: {$set: {x: 2}}}, { "command.update.$set": {x: 2}, "command.readConcern.level": "snapshot" }); -testCommand({geoSearch: kCollName, near: [0, 0], maxDistance: 1, search: {a: 1}}, - {"command.geoSearch": kCollName, "command.readConcern.level": "snapshot"}); testCommand({insert: kCollName, documents: [{x: 1}]}, {"command.insert": kCollName, "command.readConcern.level": "snapshot"}); testCommand({update: kCollName, updates: [{q: {x: 1}, u: {$set: {x: 2}}}]}, diff --git a/jstests/noPassthrough/read_majority_reads.js b/jstests/noPassthrough/read_majority_reads.js index 99a47799d6d..5c55b658d7e 100644 --- a/jstests/noPassthrough/read_majority_reads.js +++ b/jstests/noPassthrough/read_majority_reads.js @@ -6,7 +6,6 @@ * - aggregation * - distinct * - count - * - geoSearch * * Each operation is tested on a single node, and (if supported) through mongos on both sharded and * unsharded collections. Mongos doesn't directly handle readConcern majority, but these tests @@ -64,9 +63,9 @@ var cursorTestCases = { // These test cases have a run method that will be passed a collection with a single object with // _id: 1 and a state field that equals either "before" or "after". The collection will also -// contain both a 2dsphere and a geoHaystack index to enable testing commands that depend on -// them. The return value from the run method is expected to be the value of expectedBefore or -// expectedAfter depending on the state of the state field. +// contain a 2dsphere index to enable testing commands that depend on it. The return value from the +// run method is expected to be the value of expectedBefore or expectedAfter depending on the state +// of the state field. var nonCursorTestCases = { count_before: { run: function(coll) { @@ -98,21 +97,6 @@ var nonCursorTestCases = { expectedBefore: 'before', expectedAfter: 'after', }, - geoSearch: { - run: function(coll) { - var res = coll.runCommand('geoSearch', { - readConcern: {level: 'majority'}, - near: [0, 0], - search: {_id: 1}, // Needed due to SERVER-23158. - maxDistance: 1, - }); - assert.commandWorked(res); - assert.eq(res.results.length, 1, tojson(res)); - return res.results[0].state; - }, - expectedBefore: 'before', - expectedAfter: 'after', - }, }; function runTests(coll, mongodConnection) { @@ -155,7 +139,6 @@ function runTests(coll, mongodConnection) { assert.eq(oldCursor.next().state, 'after'); } - assert.commandWorked(coll.createIndex({point: 'geoHaystack', _id: 1}, {bucketSize: 1}, 0)); for (var testName in nonCursorTestCases) { jsTestLog('Running ' + testName + ' against ' + coll.toString()); var getResult = nonCursorTestCases[testName].run; @@ -213,15 +196,6 @@ var shardingTest = new ShardingTest({ }); assert(shardingTest.adminCommand({addShard: replTest.getURL()})); -// Remove tests of commands that aren't supported at all through mongos, even on unsharded -// collections. -['geoSearch'].forEach(function(cmd) { - // Make sure it really isn't supported. - assert.eq(shardingTest.getDB('test').coll.runCommand(cmd).code, ErrorCodes.CommandNotFound); - delete cursorTestCases[cmd]; - delete nonCursorTestCases[cmd]; -}); - (function testUnshardedDBThroughMongos() { var db = shardingTest.getDB("throughMongos"); runTests(db.unshardedDB, mongod); diff --git a/jstests/noPassthrough/server_read_concern_metrics.js b/jstests/noPassthrough/server_read_concern_metrics.js index f9fdb3a2a9f..ffaf094bb70 100644 --- a/jstests/noPassthrough/server_read_concern_metrics.js +++ b/jstests/noPassthrough/server_read_concern_metrics.js @@ -135,11 +135,6 @@ const sessionColl = sessionDb[collName]; testDB.runCommand({drop: collName}); assert.commandWorked(testDB.createCollection(collName)); -assert.commandWorked(testDB.runCommand({ - createIndexes: collName, - indexes: [{key: {haystack: "geoHaystack", a: 1}, name: "haystack_geo", bucketSize: 1}], - writeConcern: {w: "majority"} -})); assert.commandWorked(testColl.insert({_id: 0})); // Run an initial transaction to get config.transactions state into memory. @@ -203,17 +198,6 @@ for (let level of ["none", "local", "available", "snapshot", "majority", "linear newStatus = getServerStatus(testDB); verifyServerStatusChange(serverStatus, newStatus, level, 1); serverStatus = newStatus; - - assert.commandWorked(testDB.runCommand({ - geoSearch: collName, - near: [0, 0], - maxDistance: 1, - search: {a: 1}, - readConcern: readConcern - })); - newStatus = getServerStatus(testDB); - verifyServerStatusChange(serverStatus, newStatus, level, 1); - serverStatus = newStatus; } if (level in ["none", "local", "available"]) { diff --git a/jstests/noPassthrough/shell_can_use_read_concern.js b/jstests/noPassthrough/shell_can_use_read_concern.js index 73facc09214..a68ec7854b7 100644 --- a/jstests/noPassthrough/shell_can_use_read_concern.js +++ b/jstests/noPassthrough/shell_can_use_read_concern.js @@ -191,19 +191,6 @@ function runTests({withSession}) { } // - // Tests for the "geoSearch" command. - // - - testCommandCanBeCausallyConsistent(function() { - assert.commandWorked(coll.createIndex({loc: "geoHaystack", other: 1}, {bucketSize: 1})); - }, {expectedSession: withSession, expectedAfterClusterTime: false}); - - testCommandCanBeCausallyConsistent(function() { - assert.commandWorked( - db.runCommand({geoSearch: coll.getName(), near: [0, 0], maxDistance: 1, search: {}})); - }); - - // // Tests for the "explain" command. // diff --git a/jstests/replsets/db_reads_while_recovering_all_commands.js b/jstests/replsets/db_reads_while_recovering_all_commands.js index 288b68c9f91..26df8478e88 100644 --- a/jstests/replsets/db_reads_while_recovering_all_commands.js +++ b/jstests/replsets/db_reads_while_recovering_all_commands.js @@ -160,15 +160,6 @@ const allCommands = { flushRouterConfig: {skip: isNotAUserDataRead}, fsync: {skip: isNotAUserDataRead}, fsyncUnlock: {skip: isNotAUserDataRead}, - geoSearch: { - command: { - geoSearch: collName, - search: {}, - near: [-42, 42], - }, - expectFailure: true, - expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary - }, getCmdLineOpts: {skip: isNotAUserDataRead}, getDatabaseVersion: {skip: isNotAUserDataRead}, getDefaultRWConcern: {skip: isNotAUserDataRead}, diff --git a/jstests/replsets/tenant_migration_concurrent_writes.js b/jstests/replsets/tenant_migration_concurrent_writes.js index a35bfc0e688..c94161e2e04 100644 --- a/jstests/replsets/tenant_migration_concurrent_writes.js +++ b/jstests/replsets/tenant_migration_concurrent_writes.js @@ -699,7 +699,6 @@ const testCases = { flushRouterConfig: {skip: isNotRunOnUserDatabase}, fsync: {skip: isNotRunOnUserDatabase}, fsyncUnlock: {skip: isNotRunOnUserDatabase}, - geoSearch: {skip: isNotWriteCommand}, getCmdLineOpts: {skip: isNotRunOnUserDatabase}, getDatabaseVersion: {skip: isNotRunOnUserDatabase}, getDefaultRWConcern: {skip: isNotRunOnUserDatabase}, diff --git a/jstests/replsets/transactions_only_allowed_on_primaries.js b/jstests/replsets/transactions_only_allowed_on_primaries.js index e987eda0205..177c50b7a81 100644 --- a/jstests/replsets/transactions_only_allowed_on_primaries.js +++ b/jstests/replsets/transactions_only_allowed_on_primaries.js @@ -33,13 +33,8 @@ secondary.setSecondaryOk(); // Create a test collection that we can run commands against. const primaryDB = primary.getDB(dbName); assert.commandWorked(primary.getDB(dbName).createCollection(collName)); -assert.commandWorked(primaryDB.runCommand({ - createIndexes: collName, - indexes: [ - {name: "geo_2d", key: {geo: "2d"}}, - {key: {haystack: "geoHaystack", a: 1}, name: "haystack_geo", bucketSize: 1} - ] -})); +assert.commandWorked( + primaryDB.runCommand({createIndexes: collName, indexes: [{name: "geo_2d", key: {geo: "2d"}}]})); replTest.awaitLastOpCommitted(); /** @@ -81,7 +76,6 @@ let readCommands = [ {find: collName}, {aggregate: collName, pipeline: [{$project: {_id: 1}}], cursor: {}}, {distinct: collName, key: "_id"}, - {geoSearch: collName, near: [0, 0]} ]; jsTestLog("Testing read commands."); diff --git a/jstests/sharding/causal_consistency_shell_support.js b/jstests/sharding/causal_consistency_shell_support.js index 2f0170a5b85..cb3e02e119c 100644 --- a/jstests/sharding/causal_consistency_shell_support.js +++ b/jstests/sharding/causal_consistency_shell_support.js @@ -160,8 +160,6 @@ runCommandAndCheckLogicalTimes( runCommandAndCheckLogicalTimes(geoNearCmd, testDB, false); commandWorksAndUpdatesOperationTime(geoNearCmd, testDB); -// GeoSearch is not supported for sharded clusters. - // MapReduce doesn't currently support read concern majority. // Verify that the server rejects commands when operation time is invalid by running a command diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js index 768b2a6fccc..3fa06255bfc 100644 --- a/jstests/sharding/read_pref_cmd.js +++ b/jstests/sharding/read_pref_cmd.js @@ -308,8 +308,6 @@ let testConnReadPreference = function(conn, isMongos, rsNodes, {readPref, expect {dbStats: 1}, allowedOnSecondary.kAlways, true, formatProfileQuery(kDbName, {dbStats: 1})); assert.commandWorked(shardedColl.ensureIndex({loc: '2d'})); - assert.commandWorked( - shardedColl.ensureIndex({position: 'geoHaystack', type: 1}, {bucketSize: 10})); // TODO: SERVER-38961 Remove when simultaneous index builds complete. // Run a no-op command and wait for it to be applied on secondaries. Due to the asynchronous @@ -318,19 +316,6 @@ let testConnReadPreference = function(conn, isMongos, rsNodes, {readPref, expect assert.commandWorked(testDB.runCommand({collMod: kShardedCollName})); assert.commandWorked(testDB.runCommand({getLastError: 1, w: nodeCount})); - // Mongos doesn't implement geoSearch; test it only with ReplicaSetConnection. - if (!isMongos) { - cmdTest({ - geoSearch: kShardedCollName, - near: [1, 1], - search: {type: 'restaurant'}, - maxDistance: 10 - }, - allowedOnSecondary.kAlways, - true, - formatProfileQuery(kShardedNs, {geoSearch: kShardedCollName})); - } - // Test on sharded cmdTest({aggregate: kShardedCollName, pipeline: [{$project: {x: 1}}], cursor: {}}, allowedOnSecondary.kAlways, diff --git a/jstests/sharding/read_write_concern_defaults_application.js b/jstests/sharding/read_write_concern_defaults_application.js index b89659ac7fa..f91c5d937b9 100644 --- a/jstests/sharding/read_write_concern_defaults_application.js +++ b/jstests/sharding/read_write_concern_defaults_application.js @@ -390,18 +390,6 @@ let testCases = { forceerror: {skip: "test command"}, fsync: {skip: "does not accept read or write concern"}, fsyncUnlock: {skip: "does not accept read or write concern"}, - geoSearch: { - setUp: function(conn) { - assert.commandWorked(conn.getDB(db).runCommand({ - createIndexes: coll, - indexes: [{key: {loc: "geoHaystack", foo: 1}, bucketSize: 1, name: "foo"}], - writeConcern: {w: 1} - })); - }, - command: {geoSearch: coll, search: {}, near: [0, 0], maxDistance: 1}, - checkReadConcern: true, - checkWriteConcern: false, - }, getCmdLineOpts: {skip: "does not accept read or write concern"}, getDatabaseVersion: {skip: "does not accept read or write concern"}, getDefaultRWConcern: {skip: "does not accept read or write concern"}, diff --git a/jstests/sharding/safe_secondary_reads_drop_recreate.js b/jstests/sharding/safe_secondary_reads_drop_recreate.js index 13fffc7cb6c..fec5d200e96 100644 --- a/jstests/sharding/safe_secondary_reads_drop_recreate.js +++ b/jstests/sharding/safe_secondary_reads_drop_recreate.js @@ -175,7 +175,6 @@ let testCases = { forceerror: {skip: "does not return user data"}, fsync: {skip: "does not return user data"}, fsyncUnlock: {skip: "does not return user data"}, - geoSearch: {skip: "not supported in mongos"}, getCmdLineOpts: {skip: "does not return user data"}, getDefaultRWConcern: {skip: "does not return user data"}, getDiagnosticData: {skip: "does not return user data"}, diff --git a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js index 62efbca502b..cef8487c207 100644 --- a/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js +++ b/jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js @@ -209,7 +209,6 @@ let testCases = { forceerror: {skip: "does not return user data"}, fsync: {skip: "does not return user data"}, fsyncUnlock: {skip: "does not return user data"}, - geoSearch: {skip: "not supported in mongos"}, getCmdLineOpts: {skip: "does not return user data"}, getDefaultRWConcern: {skip: "does not return user data"}, getDiagnosticData: {skip: "does not return user data"}, diff --git a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js index f4f6b3379a3..f57aeddb0b6 100644 --- a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js +++ b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js @@ -180,7 +180,6 @@ let testCases = { forceerror: {skip: "does not return user data"}, fsync: {skip: "does not return user data"}, fsyncUnlock: {skip: "does not return user data"}, - geoSearch: {skip: "not supported in mongos"}, getCmdLineOpts: {skip: "does not return user data"}, getDefaultRWConcern: {skip: "does not return user data"}, getDiagnosticData: {skip: "does not return user data"}, diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp index f110566f4bf..7d398bce6bb 100644 --- a/src/mongo/client/dbclient_rs.cpp +++ b/src/mongo/client/dbclient_rs.cpp @@ -76,7 +76,6 @@ public: _secOkCmdList.insert("explain"); _secOkCmdList.insert("find"); _secOkCmdList.insert("geoNear"); - _secOkCmdList.insert("geoSearch"); _secOkCmdList.insert("group"); } } _populateReadPrefSecOkCmdList; diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index 2232eee33ce..58aec58909f 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -123,7 +123,6 @@ const StringMap<int> txnCmdWhitelist = {{"abortTransaction", 1}, {"find", 1}, {"findandmodify", 1}, {"findAndModify", 1}, - {"geoSearch", 1}, {"getMore", 1}, {"insert", 1}, {"killCursors", 1}, diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript index 497cf86c92d..a2fd9cf7004 100644 --- a/src/mongo/db/commands/SConscript +++ b/src/mongo/db/commands/SConscript @@ -427,7 +427,6 @@ env.Library( "dbcommands_d.cpp", "dbhash.cpp", "driverHelpers.cpp", - "haystack.cpp", "internal_rename_if_options_and_indexes_match_cmd.cpp", "map_reduce_command.cpp", "oplog_application_checks.cpp", diff --git a/src/mongo/db/commands/haystack.cpp b/src/mongo/db/commands/haystack.cpp deleted file mode 100644 index 92fc8f7a2a2..00000000000 --- a/src/mongo/db/commands/haystack.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand - -#include "mongo/platform/basic.h" - -#include <vector> - -#include "mongo/db/auth/action_set.h" -#include "mongo/db/auth/action_type.h" -#include "mongo/db/auth/privilege.h" -#include "mongo/db/catalog/collection.h" -#include "mongo/db/catalog/database.h" -#include "mongo/db/catalog/index_catalog.h" -#include "mongo/db/commands.h" -#include "mongo/db/curop.h" -#include "mongo/db/db_raii.h" -#include "mongo/db/index/expression_keys_private.h" -#include "mongo/db/index/haystack_access_method.h" -#include "mongo/db/index/haystack_access_method_internal.h" -#include "mongo/db/index/index_access_method.h" -#include "mongo/db/index/index_descriptor.h" -#include "mongo/db/index_names.h" -#include "mongo/db/jsobj.h" -#include "mongo/db/namespace_string.h" -#include "mongo/db/query/find_common.h" -#include "mongo/db/query/internal_plans.h" -#include "mongo/logv2/log.h" - -/** - * Examines all documents in a given radius of a given point. - * Returns all documents that match a given search restriction. - * See http://dochub.mongodb.org/core/haystackindexes - * - * Use when you want to look for restaurants within 25 miles with a certain name. - * Don't use when you want to find the closest open restaurants. - */ -namespace mongo { -namespace { -Rarely geoSearchDeprecationSampler; // Used to occasionally log deprecation messages. -bool loggedStartupWarning = false; -} // namespace -using std::string; -using std::vector; - -class GeoHaystackSearchCommand : public ErrmsgCommandDeprecated { -public: - GeoHaystackSearchCommand() : ErrmsgCommandDeprecated("geoSearch") {} - - virtual bool supportsWriteConcern(const BSONObj& cmd) const override { - return false; - } - - AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { - return AllowedOnSecondary::kAlways; - } - - ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj, - repl::ReadConcernLevel level) const final { - // geoSearch must support read concerns in order to be run in transactions. - return ReadConcernSupportResult::allSupportedAndDefaultPermitted(); - } - - bool shouldAffectReadConcernCounter() const override { - return true; - } - - ReadWriteType getReadWriteType() const { - return ReadWriteType::kRead; - } - - std::size_t reserveBytesForReply() const override { - return FindCommon::kInitReplyBufferSize; - } - - virtual void addRequiredPrivileges(const std::string& dbname, - const BSONObj& cmdObj, - std::vector<Privilege>* out) const { - ActionSet actions; - actions.addAction(ActionType::find); - out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); - } - - void searchHaystack(const HaystackAccessMethod* ham, - OperationContext* opCtx, - const CollectionPtr& collection, - const BSONObj& nearObj, - double maxDistance, - const BSONObj& search, - BSONObjBuilder* result, - unsigned limit) { - Timer t; - - LOGV2_DEBUG(20680, - 1, - "SEARCH near:{nearObj} maxDistance:{maxDistance} search: {search}", - "nearObj"_attr = redact(nearObj), - "maxDistance"_attr = maxDistance, - "search"_attr = redact(search)); - int x, y; - { - BSONObjIterator i(nearObj); - x = ExpressionKeysPrivate::hashHaystackElement(i.next(), ham->_bucketSize); - y = ExpressionKeysPrivate::hashHaystackElement(i.next(), ham->_bucketSize); - } - int scale = static_cast<int>(ceil(maxDistance / ham->_bucketSize)); - - GeoHaystackSearchHopper hopper( - opCtx, nearObj, maxDistance, limit, ham->_geoField, collection); - - long long btreeMatches = 0; - - for (int a = -scale; a <= scale && !hopper.limitReached(); ++a) { - for (int b = -scale; b <= scale && !hopper.limitReached(); ++b) { - BSONObjBuilder bb; - bb.append("", ExpressionKeysPrivate::makeHaystackString(x + a, y + b)); - - for (unsigned i = 0; i < ham->_otherFields.size(); i++) { - // See if the non-geo field we're indexing on is in the provided search term. - BSONElement e = dps::extractElementAtPath(search, ham->_otherFields[i]); - if (e.eoo()) - bb.appendNull(""); - else - bb.appendAs(e, ""); - } - - BSONObj key = bb.obj(); - - stdx::unordered_set<RecordId, RecordId::Hasher> thisPass; - - - auto exec = InternalPlanner::indexScan(opCtx, - &collection, - ham->_descriptor, - key, - key, - BoundInclusion::kIncludeBothStartAndEndKeys, - PlanYieldPolicy::YieldPolicy::NO_YIELD); - PlanExecutor::ExecState state; - BSONObj obj; - RecordId loc; - while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, &loc))) { - if (hopper.limitReached()) { - break; - } - pair<stdx::unordered_set<RecordId, RecordId::Hasher>::iterator, bool> p = - thisPass.insert(loc); - // If a new element was inserted (haven't seen the RecordId before), p.second - // is true. - if (p.second) { - hopper.consider(loc); - btreeMatches++; - } - } - - // Non-yielding collection scans from InternalPlanner will never error. - invariant(PlanExecutor::ADVANCED == state || PlanExecutor::IS_EOF == state); - } - } - - BSONArrayBuilder arr(result->subarrayStart("results")); - int num = hopper.appendResultsTo(&arr); - arr.done(); - - { - BSONObjBuilder b(result->subobjStart("stats")); - b.append("time", t.millis()); - b.appendNumber("btreeMatches", btreeMatches); - b.append("n", num); - b.done(); - } - } - - bool errmsgRun(OperationContext* opCtx, - const string& dbname, - const BSONObj& cmdObj, - string& errmsg, - BSONObjBuilder& result) { - if (!loggedStartupWarning) { - LOGV2_OPTIONS(4670603, - {logv2::LogTag::kStartupWarnings}, - "Support for geoSearch has been deprecated. Instead, create a 2d index " - "and use $geoNear or $geoWithin. See " - "https://dochub.mongodb.org/core/4.4-deprecate-geoHaystack"); - loggedStartupWarning = true; - geoSearchDeprecationSampler.tick(); - } else if (geoSearchDeprecationSampler.tick()) { - LOGV2_WARNING(4670604, - "Support for geoSearch has been deprecated. Instead, create a 2d index " - "and use $geoNear or $geoWithin. See " - "https://dochub.mongodb.org/core/4.4-deprecate-geoHaystack"); - } - - uassert(ErrorCodes::InvalidOptions, - "read concern snapshot is not supported for geoSearch outside of transactions", - repl::ReadConcernArgs::get(opCtx).getLevel() != - repl::ReadConcernLevel::kSnapshotReadConcern || - opCtx->inMultiDocumentTransaction()); - - const NamespaceString nss = CommandHelpers::parseNsCollectionRequired(dbname, cmdObj); - - AutoGetCollectionForReadCommand ctx(opCtx, nss); - - // Check whether we are allowed to read from this node after acquiring our locks. - auto replCoord = repl::ReplicationCoordinator::get(opCtx); - uassertStatusOK(replCoord->checkCanServeReadsFor( - opCtx, nss, ReadPreferenceSetting::get(opCtx).canRunOnSecondary())); - - const auto& collection = ctx.getCollection(); - if (!collection) { - errmsg = "can't find ns"; - return false; - } - - vector<const IndexDescriptor*> idxs; - collection->getIndexCatalog()->findIndexByType(opCtx, IndexNames::GEO_HAYSTACK, idxs); - if (idxs.size() == 0) { - errmsg = "no geoSearch index"; - return false; - } - if (idxs.size() > 1) { - errmsg = "more than 1 geosearch index"; - return false; - } - - BSONElement nearElt = cmdObj["near"]; - BSONElement maxDistance = cmdObj["maxDistance"]; - BSONElement search = cmdObj["search"]; - - uassert(13318, "near needs to be an array", nearElt.isABSONObj()); - uassert(13319, "maxDistance needs a number", maxDistance.isNumber()); - uassert(13320, "search needs to be an object", search.type() == Object); - - unsigned limit = 50; - if (cmdObj["limit"].isNumber()) - limit = static_cast<unsigned>(cmdObj["limit"].numberInt()); - - const IndexDescriptor* desc = idxs[0]; - auto ham = static_cast<const HaystackAccessMethod*>( - collection->getIndexCatalog()->getEntry(desc)->accessMethod()); - searchHaystack(ham, - opCtx, - collection, - nearElt.Obj(), - maxDistance.numberDouble(), - search.Obj(), - &result, - limit); - return 1; - } -} nameSearchCommand; - -} // namespace mongo diff --git a/src/mongo/dbtests/commandtests.cpp b/src/mongo/dbtests/commandtests.cpp index 1066fe6ddb9..2e354795911 100644 --- a/src/mongo/dbtests/commandtests.cpp +++ b/src/mongo/dbtests/commandtests.cpp @@ -294,56 +294,6 @@ public: // TODO(kangas) test that Tom's score is 1 } }; - -class GeoSearch : Base { -public: - void run() { - // Subset of geo_haystack1.js - - int n = 0; - for (int x = 0; x < 20; x++) { - for (int y = 0; y < 20; y++) { - db.insert(nss().ns(), - BSON("_id" << n << "loc" << BSON_ARRAY(x << y) << "z" << n % 5)); - n++; - } - } - - // Build geoHaystack index. Can's use db.ensureIndex, no way to pass "bucketSize". - // So run createIndexes command instead. - // - // Shell example: - // t.ensureIndex( { loc : "geoHaystack" , z : 1 }, { bucketSize : .7 } ); - - { - BSONObjBuilder cmd; - cmd.append("createIndexes", nsColl()); - cmd.append("indexes", - BSON_ARRAY(BSON("key" << BSON("loc" - << "geoHaystack" - << "z" << 1.0) - << "name" - << "loc_geoHaystack_z_1" - << "bucketSize" << static_cast<double>(0.7)))); - - BSONObj result; - ASSERT(db.runCommand(nsDb(), cmd.obj(), result)); - } - - { - BSONObjBuilder cmd; - cmd.appendSymbol("geoSearch", nsColl()); // Use Symbol for SERVER-16260 - cmd.append("near", BSON_ARRAY(7 << 8)); - cmd.append("maxDistance", 3); - cmd.append("search", BSON("z" << 3)); - - BSONObj result; - bool ok = db.runCommand(nsDb(), cmd.obj(), result); - LOGV2(24187, "{result_jsonString}", "result_jsonString"_attr = result.jsonString()); - ASSERT(ok); - } - } -}; } // namespace SymbolArgument /** @@ -375,7 +325,6 @@ public: add<SymbolArgument::DropIndexes>(); add<SymbolArgument::FindAndModify>(); add<SymbolArgument::Drop>(); - add<SymbolArgument::GeoSearch>(); add<SymbolArgument::CreateIndexWithNoKey>(); add<SymbolArgument::CreateIndexWithDuplicateKey>(); add<SymbolArgument::CreateIndexWithEmptyStringAsValue>(); diff --git a/src/mongo/shell/session.js b/src/mongo/shell/session.js index d802d391010..c0427aebef2 100644 --- a/src/mongo/shell/session.js +++ b/src/mongo/shell/session.js @@ -157,7 +157,6 @@ var { "explain", "find", "geoNear", - "geoSearch", "group", ]); |