summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml23
-rw-r--r--buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml25
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/read_concern_linearizable_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/replica_sets_initsync_jscore_passthrough.yml1
-rw-r--r--buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/replica_sets_multi_stmt_txn_jscore_passthrough.yml1
-rw-r--r--buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml3
-rw-r--r--buildscripts/resmokeconfig/suites/secondary_reads_passthrough.yml1
-rw-r--r--buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml22
-rw-r--r--buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml1
-rw-r--r--buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml1
-rw-r--r--buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml1
-rw-r--r--buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml3
-rw-r--r--etc/evergreen.yml2
-rw-r--r--jstests/auth/auth1.js18
-rw-r--r--jstests/auth/js_scope_leak.js23
-rw-r--r--jstests/auth/lib/commands_lib.js20
-rw-r--r--jstests/concurrency/fsm_workloads/indexed_insert_eval.js33
-rw-r--r--jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js18
-rw-r--r--jstests/concurrency/fsm_workloads/remove_single_document_eval.js37
-rw-r--r--jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js16
-rw-r--r--jstests/concurrency/fsm_workloads/update_simple_eval.js33
-rw-r--r--jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js16
-rw-r--r--jstests/core/apitest_db.js1
-rw-r--r--jstests/core/constructors.js29
-rw-r--r--jstests/core/error2.js7
-rw-r--r--jstests/core/eval0.js28
-rw-r--r--jstests/core/eval1.js22
-rw-r--r--jstests/core/eval3.js43
-rw-r--r--jstests/core/eval4.js31
-rw-r--r--jstests/core/eval5.js23
-rw-r--r--jstests/core/eval6.js20
-rw-r--r--jstests/core/eval7.js12
-rw-r--r--jstests/core/eval8.js22
-rw-r--r--jstests/core/eval9.js33
-rw-r--r--jstests/core/eval_mr.js31
-rw-r--r--jstests/core/eval_nolock.js23
-rw-r--r--jstests/core/eval_wait_for_read_write_concern.js16
-rw-r--r--jstests/core/evala.js15
-rw-r--r--jstests/core/evalb.js55
-rw-r--r--jstests/core/evald.js105
-rw-r--r--jstests/core/evale.js19
-rw-r--r--jstests/core/evalg.js19
-rw-r--r--jstests/core/evalh.js23
-rw-r--r--jstests/core/evalj.js18
-rw-r--r--jstests/core/fsync.js6
-rw-r--r--jstests/core/function_string_representations.js1
-rw-r--r--jstests/core/js3.js19
-rw-r--r--jstests/core/js7.js11
-rw-r--r--jstests/core/js9.js13
-rw-r--r--jstests/core/json_schema/misc_validation.js14
-rw-r--r--jstests/core/recursion.js12
-rw-r--r--jstests/core/remove8.js8
-rw-r--r--jstests/core/rename4.js1
-rw-r--r--jstests/core/storefunc.js31
-rw-r--r--jstests/core/txns/commands_not_allowed_in_txn.js2
-rw-r--r--jstests/core/txns/statement_ids_accepted.js18
-rw-r--r--jstests/core/views/views_all_commands.js1
-rw-r--r--jstests/libs/override_methods/auto_retry_on_network_error.js4
-rw-r--r--jstests/libs/override_methods/set_read_and_write_concerns.js6
-rw-r--r--jstests/libs/parallelTester.js1
-rw-r--r--jstests/noPassthrough/implicit_sessions.js26
-rw-r--r--jstests/noPassthrough/low_js_heap_limit.js5
-rw-r--r--jstests/noPassthrough/shell_cmd_assertions.js21
-rw-r--r--jstests/noPassthroughWithMongod/eval_with_godinsert.js15
-rw-r--r--jstests/parallel/checkMultiThread.js2
-rw-r--r--jstests/replsets/stepdown_kill_other_ops.js35
-rw-r--r--jstests/serial_run/memory.js64
-rw-r--r--jstests/sharding/database_and_shard_versioning_all_commands.js11
-rw-r--r--jstests/sharding/features1.js46
-rw-r--r--jstests/sharding/safe_secondary_reads_drop_recreate.js1
-rw-r--r--jstests/sharding/safe_secondary_reads_single_migration_suspend_range_deletion.js1
-rw-r--r--jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js1
-rw-r--r--src/mongo/bson/oid.h2
-rw-r--r--src/mongo/bson/util/builder.h1
-rw-r--r--src/mongo/client/dbclient_base.cpp21
-rw-r--r--src/mongo/client/dbclient_base.h50
-rw-r--r--src/mongo/db/commands/SConscript1
-rw-r--r--src/mongo/db/commands/eval.cpp219
-rw-r--r--src/mongo/db/service_entry_point_common.cpp2
-rw-r--r--src/mongo/dbtests/jstests.cpp1193
-rw-r--r--src/mongo/s/commands/SConscript1
-rw-r--r--src/mongo/s/commands/cluster_eval_cmd.cpp91
-rw-r--r--src/mongo/scripting/engine.cpp3
-rw-r--r--src/mongo/scripting/engine.h1
-rw-r--r--src/mongo/scripting/mozjs/implscope.cpp38
-rw-r--r--src/mongo/scripting/mozjs/implscope.h11
-rw-r--r--src/mongo/scripting/mozjs/mongo.cpp76
-rw-r--r--src/mongo/scripting/mozjs/mongo.h7
-rw-r--r--src/mongo/scripting/mozjs/proxyscope.cpp4
-rw-r--r--src/mongo/scripting/mozjs/proxyscope.h2
113 files changed, 81 insertions, 3007 deletions
diff --git a/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml b/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml
index b0527f8dd8b..2cd06012e03 100644
--- a/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/aggregation_read_concern_majority_passthrough.yml
@@ -29,9 +29,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml
index 8eaa08c3f36..573e6089fc3 100644
--- a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough.yml
@@ -25,7 +25,6 @@ selector:
- jstests/core/diagdata.js # Command not supported in mongos
- jstests/core/do_txn*.js # doTxn
- jstests/core/dropdb_race.js # syncdelay.
- - jstests/core/evalb.js # db.eval() and profiling.
- jstests/core/fsync.js # uses fsync.
- jstests/core/geo_haystack*.js # geoSearch.
- jstests/core/geo_update_btree2.js # notablescan.
@@ -55,24 +54,6 @@ selector:
- jstests/core/batch_write_command*.js # these tests use various write concerns
- jstests/core/bench_test*.js # benchRun() used for writes
- jstests/core/crud_api.js # has specific w:0 tests
- - jstests/core/error2.js # db.eval() used
- - jstests/core/eval0.js # db.eval() used
- - jstests/core/eval1.js # db.eval() used
- - jstests/core/eval3.js # db.eval() used
- - jstests/core/eval4.js # db.eval() used
- - jstests/core/eval5.js # db.eval() used
- - jstests/core/eval6.js # db.eval() used
- - jstests/core/eval7.js # db.eval() used
- - jstests/core/eval9.js # db.eval() used
- - jstests/core/evala.js # db.eval() used
- - jstests/core/evald.js # db.eval() used
- - jstests/core/evale.js # db.eval() used
- - jstests/core/evalg.js # db.eval() used
- - jstests/core/eval_mr.js # db.eval() used
- - jstests/core/eval_nolock.js # db.eval() used
- - jstests/core/js3.js # db.dbEval() used
- - jstests/core/js7.js # db.eval() used
- - jstests/core/js9.js # db.eval() used
- jstests/core/mr_merge.js # mr temp tables aren't replicated
- jstests/core/mr_merge2.js # mr temp tables aren't replicated
- jstests/core/mr_outreduce.js # mr temp tables aren't replicated
@@ -80,12 +61,8 @@ selector:
- jstests/core/opcounters_active.js # off by n problem with opcounters
- jstests/core/opcounters_write_cmd.js # off by n problem with opcounters
- jstests/core/read_after_optime.js # verifies read after optime fails on standalone
- - jstests/core/remove8.js # db.eval() used
- - jstests/core/rename4.js # db.eval() used
- jstests/core/shell1.js # tests setSlaveOk() variations on standalone mongod
- - jstests/core/shellkillop.js # db.eval() used
- jstests/core/shell_writeconcern.js # checks write concern shell helpers
- - jstests/core/storefunc.js # db.eval() used
- jstests/core/write_result.js # Tests invalid writeConcern, we shouldn't override.
# Tests that need triaging & remediation | blacklist decision
# Comments list possible problem point under review.
diff --git a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml
index bbe744b2286..a79331a8ee9 100644
--- a/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml
+++ b/buildscripts/resmokeconfig/suites/causally_consistent_jscore_passthrough_auth.yml
@@ -39,7 +39,6 @@ selector:
- jstests/core/diagdata.js # Command not supported in mongos
- jstests/core/do_txn*.js # doTxn
- jstests/core/dropdb_race.js # syncdelay.
- - jstests/core/evalb.js # db.eval() and profiling.
- jstests/core/fsync.js # uses fsync.
- jstests/core/geo_haystack*.js # geoSearch.
- jstests/core/geo_update_btree2.js # notablescan.
@@ -69,24 +68,6 @@ selector:
- jstests/core/batch_write_command*.js # these tests use various write concerns
- jstests/core/bench_test*.js # benchRun() used for writes
- jstests/core/crud_api.js # has specific w:0 tests
- - jstests/core/error2.js # db.eval() used
- - jstests/core/eval0.js # db.eval() used
- - jstests/core/eval1.js # db.eval() used
- - jstests/core/eval3.js # db.eval() used
- - jstests/core/eval4.js # db.eval() used
- - jstests/core/eval5.js # db.eval() used
- - jstests/core/eval6.js # db.eval() used
- - jstests/core/eval7.js # db.eval() used
- - jstests/core/eval9.js # db.eval() used
- - jstests/core/evala.js # db.eval() used
- - jstests/core/evald.js # db.eval() used
- - jstests/core/evale.js # db.eval() used
- - jstests/core/evalg.js # db.eval() used
- - jstests/core/eval_mr.js # db.eval() used
- - jstests/core/eval_nolock.js # db.eval() used
- - jstests/core/js3.js # db.dbEval() used
- - jstests/core/js7.js # db.eval() used
- - jstests/core/js9.js # db.eval() used
- jstests/core/mr_merge.js # mr temp tables aren't replicated
- jstests/core/mr_merge2.js # mr temp tables aren't replicated
- jstests/core/mr_outreduce.js # mr temp tables aren't replicated
@@ -94,12 +75,8 @@ selector:
- jstests/core/opcounters_active.js # off by n problem with opcounters
- jstests/core/opcounters_write_cmd.js # off by n problem with opcounters
- jstests/core/read_after_optime.js # verifies read after optime fails on standalone
- - jstests/core/remove8.js # db.eval() used
- - jstests/core/rename4.js # db.eval() used
- jstests/core/shell1.js # tests setSlaveOk() variations on standalone mongod
- - jstests/core/shellkillop.js # db.eval() used
- jstests/core/shell_writeconcern.js # checks write concern shell helpers
- - jstests/core/storefunc.js # db.eval() used
- jstests/core/write_result.js # Tests invalid writeConcern, we shouldn't override.
# Tests that need triaging & remediation | blacklist decision
# Comments list possible problem point under review.
@@ -183,8 +160,6 @@ selector:
# TODO SERVER-35447: Multiple users cannot be authenticated on one connection within a session.
- creates_and_authenticates_user
- requires_collstats
- # This suite runs as the root user, but eval requires universal privileges with authentication on.
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/change_streams.yml b/buildscripts/resmokeconfig/suites/change_streams.yml
index 6b12b44048d..c066c811d49 100644
--- a/buildscripts/resmokeconfig/suites/change_streams.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams.yml
@@ -14,9 +14,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml
index 19c5c955d05..4be978a6264 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_mongos_passthrough.yml
@@ -18,9 +18,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Transactions not supported on sharded clusters.
- uses_transactions
diff --git a/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml
index ec41092246c..29531e940e9 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_mongos_sessions_passthrough.yml
@@ -18,9 +18,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Transactions not supported on sharded clusters.
- uses_transactions
diff --git a/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml b/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml
index 712986a1950..96b9263f17c 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_secondary_reads.yml
@@ -20,9 +20,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
##
# The next tag corresponds to the special error thrown by the set_read_preference_secondary.js
# override when it refuses to replace the readPreference of a particular command. Above each tag
diff --git a/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml
index 702997774f7..cab7e64392c 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_sharded_collections_passthrough.yml
@@ -25,9 +25,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Transactions not supported on sharded clusters.
- uses_transactions
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml
index d1cddfd10b6..8997157ab46 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_mongos_passthrough.yml
@@ -18,9 +18,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Transactions not supported on sharded clusters.
- uses_transactions
# Not relevant for whole-cluster change streams.
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml
index 6c9013a4a19..fe558dcc627 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_passthrough.yml
@@ -14,9 +14,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Not relevant for whole-cluster change streams.
- do_not_run_in_whole_cluster_passthrough
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml
index d6094a5754e..a30e2128ae1 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_secondary_reads_passthrough.yml
@@ -20,9 +20,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
##
# The next tag corresponds to the special error thrown by the set_read_preference_secondary.js
# override when it refuses to replace the readPreference of a particular command. Above each tag
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml
index d83d9602883..e46b04ee0fd 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_cluster_sharded_collections_passthrough.yml
@@ -21,9 +21,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Transactions not supported on sharded clusters.
- uses_transactions
# Not relevant for whole-cluster change streams.
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml
index 0c08e630f4c..2a8905fe3b9 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_mongos_passthrough.yml
@@ -24,9 +24,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Transactions not supported on sharded clusters.
- uses_transactions
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml
index 639179c90b9..3cd4cd39df7 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_passthrough.yml
@@ -17,9 +17,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml
index 838dd2ffce7..2284830db48 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_secondary_reads_passthrough.yml
@@ -23,9 +23,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
##
# The next tag corresponds to the special error thrown by the set_read_preference_secondary.js
# override when it refuses to replace the readPreference of a particular command. Above each tag
diff --git a/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml b/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml
index 3c3ca25c1af..bc184d9dcfb 100644
--- a/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/change_streams_whole_db_sharded_collections_passthrough.yml
@@ -26,9 +26,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
# Transactions not supported on sharded clusters.
- uses_transactions
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml
index d7a5f031b63..3c7140fec39 100644
--- a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml
+++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml
@@ -72,13 +72,6 @@ selector:
# can cause OOM kills on test hosts
- jstests/concurrency/fsm_workloads/findAndModify_update_grow.js
- # eval doesn't work with sharded collections
- - jstests/concurrency/fsm_workloads/indexed_insert_eval.js
- - jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
- - jstests/concurrency/fsm_workloads/update_simple_eval.js
- - jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
# cannot ensureIndex after dropDatabase without sharding first
- jstests/concurrency/fsm_workloads/plan_cache_drop_database.js
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml
index 70789a7661e..783b549363f 100644
--- a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml
+++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml
@@ -75,13 +75,6 @@ selector:
# can cause OOM kills on test hosts
- jstests/concurrency/fsm_workloads/findAndModify_update_grow.js
- # eval doesn't work with sharded collections
- - jstests/concurrency/fsm_workloads/indexed_insert_eval.js
- - jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
- - jstests/concurrency/fsm_workloads/update_simple_eval.js
- - jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
# cannot ensureIndex after dropDatabase without sharding first
- jstests/concurrency/fsm_workloads/plan_cache_drop_database.js
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml
index 6c2b1abb12b..7687691510d 100644
--- a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml
+++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml
@@ -69,13 +69,6 @@ selector:
# can cause OOM kills on test hosts
- jstests/concurrency/fsm_workloads/findAndModify_update_grow.js
- # eval doesn't work with sharded collections
- - jstests/concurrency/fsm_workloads/indexed_insert_eval.js
- - jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
- - jstests/concurrency/fsm_workloads/update_simple_eval.js
- - jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
# cannot ensureIndex after dropDatabase without sharding first
- jstests/concurrency/fsm_workloads/plan_cache_drop_database.js
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml
index b1aebf02d2f..7ebca6162ff 100644
--- a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml
+++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml
@@ -72,13 +72,6 @@ selector:
# can cause OOM kills on test hosts
- jstests/concurrency/fsm_workloads/findAndModify_update_grow.js
- # eval doesn't work with sharded collections
- - jstests/concurrency/fsm_workloads/indexed_insert_eval.js
- - jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
- - jstests/concurrency/fsm_workloads/update_simple_eval.js
- - jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
# cannot ensureIndex after dropDatabase without sharding first
- jstests/concurrency/fsm_workloads/plan_cache_drop_database.js
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml
index 44a614fda26..c9b9453055c 100644
--- a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml
+++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml
@@ -69,13 +69,6 @@ selector:
# can cause OOM kills on test hosts
- jstests/concurrency/fsm_workloads/findAndModify_update_grow.js
- # eval doesn't work with sharded collections
- - jstests/concurrency/fsm_workloads/indexed_insert_eval.js
- - jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
- - jstests/concurrency/fsm_workloads/update_simple_eval.js
- - jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
# cannot ensureIndex after dropDatabase without sharding first
- jstests/concurrency/fsm_workloads/plan_cache_drop_database.js
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml
index c7c360a362e..aa99d52a929 100644
--- a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml
+++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml
@@ -72,13 +72,6 @@ selector:
# can cause OOM kills on test hosts
- jstests/concurrency/fsm_workloads/findAndModify_update_grow.js
- # eval doesn't work with sharded collections
- - jstests/concurrency/fsm_workloads/indexed_insert_eval.js
- - jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval.js
- - jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
- - jstests/concurrency/fsm_workloads/update_simple_eval.js
- - jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
# cannot ensureIndex after dropDatabase without sharding first
- jstests/concurrency/fsm_workloads/plan_cache_drop_database.js
diff --git a/buildscripts/resmokeconfig/suites/read_concern_linearizable_passthrough.yml b/buildscripts/resmokeconfig/suites/read_concern_linearizable_passthrough.yml
index 00af43ab88a..997d0ddd66b 100644
--- a/buildscripts/resmokeconfig/suites/read_concern_linearizable_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/read_concern_linearizable_passthrough.yml
@@ -27,9 +27,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml b/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml
index 77c3607f631..b34694ec791 100644
--- a/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/read_concern_majority_passthrough.yml
@@ -25,9 +25,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/replica_sets_initsync_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_initsync_jscore_passthrough.yml
index 8122140e2cc..5e3f61b5b21 100644
--- a/buildscripts/resmokeconfig/suites/replica_sets_initsync_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/replica_sets_initsync_jscore_passthrough.yml
@@ -14,7 +14,6 @@ selector:
- jstests/core/collation.js
- jstests/core/commands_that_do_not_write_do_not_accept_wc.js
- jstests/core/constructors.js
- - jstests/core/eval_mr.js
- jstests/core/function_string_representations.js
- jstests/core/geo_big_polygon3.js
- jstests/core/geo_mapreduce.js
diff --git a/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml
index 125a72f827e..959cea4f8ce 100644
--- a/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml
@@ -117,9 +117,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
##
# The next three tags corresponds to the special errors thrown by the error_on_fast_count.js
# override when it refuses to run commands that are innacurate after an unclean shutdown. Above
diff --git a/buildscripts/resmokeconfig/suites/replica_sets_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_multi_stmt_txn_jscore_passthrough.yml
index fab5ce7009b..1ee3e8a309c 100644
--- a/buildscripts/resmokeconfig/suites/replica_sets_multi_stmt_txn_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/replica_sets_multi_stmt_txn_jscore_passthrough.yml
@@ -256,7 +256,6 @@ selector:
- jstests/core/coveredIndex3.js
- jstests/core/currentop.js
- jstests/core/distinct3.js
- - jstests/core/evald.js
- jstests/core/find_and_modify_concurrent_update.js
- jstests/core/fsync.js
- jstests/core/geo_update_btree.js
diff --git a/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml
index 997f4152511..8bbe5a0b73c 100644
--- a/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml
@@ -117,9 +117,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml b/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml
index f715c90c450..041517d11d6 100644
--- a/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml
@@ -110,9 +110,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
executor:
archive:
diff --git a/buildscripts/resmokeconfig/suites/secondary_reads_passthrough.yml b/buildscripts/resmokeconfig/suites/secondary_reads_passthrough.yml
index 11be2d3d4b8..61213855559 100644
--- a/buildscripts/resmokeconfig/suites/secondary_reads_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/secondary_reads_passthrough.yml
@@ -44,7 +44,6 @@ selector:
- jstests/core/find_and_modify_concurrent_update.js
- jstests/core/shellstartparallel.js
- jstests/core/loadserverscripts.js
- - jstests/core/evald.js
- jstests/core/fsync.js
# benchRun cannot be overridden to be causally consistent
- jstests/core/bench_test*.js
diff --git a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml
index 89572b4cfd4..a3fab831fd6 100644
--- a/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/sharded_causally_consistent_jscore_passthrough.yml
@@ -28,7 +28,6 @@ selector:
- jstests/core/diagdata.js # Command not supported in mongos
- jstests/core/do_txn*.js # doTxn
- jstests/core/dropdb_race.js # syncdelay.
- - jstests/core/evalb.js # profiling.
- jstests/core/fsync.js # uses fsync.
- jstests/core/geo_haystack*.js # geoSearch.
- jstests/core/geo_update_btree2.js # notablescan.
@@ -88,35 +87,14 @@ selector:
- jstests/core/batch_write_command*.js # these tests use various write concerns
- jstests/core/bench_test*.js # benchRun() used for writes
- jstests/core/crud_api.js # has specific w:0 tests
- - jstests/core/error2.js # db.eval() used
- - jstests/core/eval0.js # db.eval() used
- - jstests/core/eval1.js # db.eval() used
- - jstests/core/eval3.js # db.eval() used
- - jstests/core/eval4.js # db.eval() used
- - jstests/core/eval5.js # db.eval() used
- - jstests/core/eval6.js # db.eval() used
- - jstests/core/eval7.js # db.eval() used
- - jstests/core/eval9.js # db.eval() used
- - jstests/core/evala.js # db.eval() used
- - jstests/core/evald.js # db.eval() used
- - jstests/core/evale.js # db.eval() used
- - jstests/core/evalg.js # db.eval() used
- - jstests/core/eval_mr.js # db.eval() used
- - jstests/core/eval_nolock.js # db.eval() used
- - jstests/core/js3.js # db.dbEval() used
- - jstests/core/js7.js # db.eval() used
- - jstests/core/js9.js # db.eval() used
- jstests/core/mr_merge.js # mr temp tables aren't replicated
- jstests/core/mr_merge2.js # mr temp tables aren't replicated
- jstests/core/mr_outreduce.js # mr temp tables aren't replicated
- jstests/core/mr_outreduce2.js # mr temp tables aren't replicated
- jstests/core/opcounters_active.js # off by n problem with opcounters
- jstests/core/opcounters_write_cmd.js # off by n problem with opcounters
- - jstests/core/remove8.js # db.eval() used
- jstests/core/shell1.js # tests setSlaveOk() variations on standalone mongod
- - jstests/core/shellkillop.js # db.eval() used
- jstests/core/shell_writeconcern.js # checks write concern shell helpers
- - jstests/core/storefunc.js # db.eval() used
- jstests/core/write_result.js # Tests invalid writeConcern, we shouldn't override.
# Tests that need triaging & remediation | blacklist decision
# Comments list possible problem point under review.
diff --git a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml
index c9e746bf608..57ff3c526a8 100644
--- a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml
@@ -27,7 +27,6 @@ selector:
- jstests/core/diagdata.js # Command not supported in mongos
- jstests/core/do_txn*.js # doTxn
- jstests/core/dropdb_race.js # syncdelay.
- - jstests/core/evalb.js # profiling.
- jstests/core/fsync.js # uses fsync.
- jstests/core/geo_haystack*.js # geoSearch.
- jstests/core/geo_s2cursorlimitskip.js # profiling.
diff --git a/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml
index a150217bc2b..291f86810a2 100644
--- a/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/sharding_jscore_op_query_passthrough.yml
@@ -26,7 +26,6 @@ selector:
- jstests/core/diagdata.js # Command not supported in mongos
- jstests/core/do_txn*.js # doTxn
- jstests/core/dropdb_race.js # syncdelay.
- - jstests/core/evalb.js # profiling.
- jstests/core/fsync.js # uses fsync.
- jstests/core/geo_haystack*.js # geoSearch.
- jstests/core/geo_s2cursorlimitskip.js # profiling.
diff --git a/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml
index 6be19ac20b8..3d87cc7b707 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/do_txn*.js # do_txn
- jstests/core/dropdb_race.js # syncdelay.
- - jstests/core/evalb.js # profiling.
- jstests/core/fsync.js # uses fsync.
- jstests/core/geo_haystack*.js # geoSearch.
- jstests/core/geo_s2cursorlimitskip.js # profiling.
diff --git a/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml b/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml
index 1861eeab900..71f55903961 100644
--- a/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/write_concern_majority_passthrough.yml
@@ -28,9 +28,6 @@ selector:
- assumes_read_concern_unchanged
# "Cowardly refusing to override write concern of command: ..."
- assumes_write_concern_unchanged
- # "Cowardly refusing to run test with overridden write concern when it uses a command that can
- # only perform w=1 writes: ..."
- - requires_eval_command
##
# The next tag corresponds to the special error thrown by the set_read_preference_secondary.js
# override when it refuses to replace the readPreference of a particular command. Above each tag
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index ad18050b21d..48d4ef880f2 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -4443,7 +4443,7 @@ tasks:
- func: "do setup"
- func: "run tests"
vars:
- resmoke_args: --suites=core --mongod=./mongoed --excludeWithAnyTags=requires_scripting,requires_auth,requires_sharding,does_not_support_stepdowns,requires_eval_command,requires_background_index,incompatible_with_embedded,incompatible_with_embedded_todo_investigate,requires_replication,requires_capped,requires_profiling
+ resmoke_args: --suites=core --mongod=./mongoed --excludeWithAnyTags=requires_scripting,requires_auth,requires_sharding,does_not_support_stepdowns,requires_background_index,incompatible_with_embedded,incompatible_with_embedded_todo_investigate,requires_replication,requires_capped,requires_profiling,requires_javascript,requires_fsync
run_multiple_jobs: true
- <<: *task_template
diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js
index a0fb16dbac3..f636403c6c0 100644
--- a/jstests/auth/auth1.js
+++ b/jstests/auth/auth1.js
@@ -41,8 +41,6 @@ function runTest(m) {
print("make sure we can't run certain commands w/out auth");
var codeUnauthorized = 13;
- var rslt = db.runCommand({eval: "function() { return 1; }"});
- assert.eq(rslt.code, codeUnauthorized, tojson(rslt));
var rslt = db.runCommand({getLog: "global"});
assert.eq(rslt.code, codeUnauthorized, tojson(rslt));
@@ -75,19 +73,9 @@ function runTest(m) {
assert.eq(1000, tRO.count(), "B6");
db.getSiblingDB('admin').auth('super', 'super');
- assert.eq(1000,
- db.eval(function() {
- return db["jstests_auth_auth1"].count();
- }),
- "D1");
- db.eval(function() {
- db["jstests_auth_auth1"].save({i: 1000});
- });
- assert.eq(1001,
- db.eval(function() {
- return db["jstests_auth_auth1"].count();
- }),
- "D2");
+ assert.eq(1000, t.count(), "D1");
+ t.insert({i: 1000});
+ assert.eq(1001, t.count(), "D2");
print("SUCCESS auth1.js");
}
diff --git a/jstests/auth/js_scope_leak.js b/jstests/auth/js_scope_leak.js
index ef6d539d0db..cb09fcda70e 100644
--- a/jstests/auth/js_scope_leak.js
+++ b/jstests/auth/js_scope_leak.js
@@ -5,7 +5,7 @@
// auth user 'a' -> auth user 'b'
// auth user 'b' -> logout
//
-// These transitions are tested for dbEval, $where and MapReduce.
+// These transitions are tested for $where and MapReduce.
var conn = MongoRunner.runMongod({smallfiles: ""});
var test = conn.getDB("test");
@@ -26,27 +26,6 @@ function missingOrEquals(string) {
'}()';
}
-function testDbEval() {
- // set the global variable 'someGlobal' before authenticating
- test.eval('someGlobal = "noUsers";');
-
- // test new user auth causes scope to be cleared
- test.auth('a', 'a');
- assert(test.eval('return ' + missingOrEquals('a')), "dbEval: Auth user 'a'");
-
- // test auth as another user causes scope to be cleared
- test.eval('someGlobal = "a";');
- test.auth('b', 'b');
- assert(test.eval('return ' + missingOrEquals('a&b')), "dbEval: Auth user 'b'");
-
- // test user logout causes scope to be cleared
- test.eval('someGlobal = "a&b";');
- test.logout();
- assert(test.eval('return ' + missingOrEquals('noUsers')), "dbEval: log out");
-}
-testDbEval();
-testDbEval();
-
// test $where
function testWhere() {
// set the global variable 'someGlobal' before authenticating
diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js
index b04f48f060d..ed7ae60138b 100644
--- a/jstests/auth/lib/commands_lib.js
+++ b/jstests/auth/lib/commands_lib.js
@@ -3566,26 +3566,6 @@ var authCommandsLib = {
]
},
{
- testname: "eval",
- command: {
- $eval: function() {
- print("noop");
- }
- },
- testcases: [
- {
- runOnDb: firstDbName,
- roles: {__system: 1},
- privileges: [{resource: {anyResource: true}, actions: ["anyAction"]}]
- },
- {
- runOnDb: secondDbName,
- roles: {__system: 1},
- privileges: [{resource: {anyResource: true}, actions: ["anyAction"]}]
- }
- ]
- },
- {
testname: "features",
command: {features: 1},
testcases: [
diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_eval.js b/jstests/concurrency/fsm_workloads/indexed_insert_eval.js
deleted file mode 100644
index f35d4565e3b..00000000000
--- a/jstests/concurrency/fsm_workloads/indexed_insert_eval.js
+++ /dev/null
@@ -1,33 +0,0 @@
-'use strict';
-
-/**
- * indexed_insert_eval.js
- *
- * Inserts multiple documents into an indexed collection using the eval command.
- * Asserts that all documents appear in both a collection scan and an index
- * scan. The indexed value is the thread id.
- */
-load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
-load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config
-
-var $config = extendWorkload($config, function($config, $super) {
-
- $config.data.nolock = false;
-
- $config.states.insert = function insert(db, collName) {
- var evalResult = db.runCommand({
- eval: function(collName, doc) {
- var insertResult = db[collName].insert(doc);
- return tojson(insertResult);
- },
- args: [collName, this.getDoc()],
- nolock: this.nolock
- });
- assertAlways.commandWorked(evalResult);
- var insertResult = JSON.parse(evalResult.retval);
- assertAlways.eq(1, insertResult.nInserted, tojson(insertResult));
- this.nInserted += this.docsPerInsert;
- };
-
- return $config;
-});
diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js b/jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
deleted file mode 100644
index f87ba5da790..00000000000
--- a/jstests/concurrency/fsm_workloads/indexed_insert_eval_nolock.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-/**
- * indexed_insert_eval_nolock.js
- *
- * Inserts multiple documents into an indexed collection using the eval command
- * with the option { nolock: true }. Asserts that all documents appear in both a
- * collection scan and an index scan. The indexed value is the thread id.
- */
-load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
-load('jstests/concurrency/fsm_workloads/indexed_insert_eval.js'); // for $config
-
-var $config = extendWorkload($config, function($config, $super) {
-
- $config.data.nolock = true;
-
- return $config;
-});
diff --git a/jstests/concurrency/fsm_workloads/remove_single_document_eval.js b/jstests/concurrency/fsm_workloads/remove_single_document_eval.js
deleted file mode 100644
index 3109c743e29..00000000000
--- a/jstests/concurrency/fsm_workloads/remove_single_document_eval.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-
-/**
- * remove_single_document_eval.js
- *
- * Runs remove_single_document using the eval command.
- */
-load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
-load('jstests/concurrency/fsm_workloads/remove_single_document.js'); // for $config
-
-var $config = extendWorkload($config, function($config, $super) {
-
- $config.data.doRemove = function doRemove(db, collName, query, options) {
- var evalResult = db.runCommand({
- eval: function(f, collName, query, options) {
- return tojson(f(db, collName, query, options));
- },
- args: [$super.data.doRemove, collName, query, options],
- nolock: this.nolock
- });
- assertAlways.commandWorked(evalResult);
- var res = JSON.parse(evalResult.retval);
- return res;
- };
-
- $config.data.assertResult = function assertResult(res) {
- assertWhenOwnColl.eq(1, res.nRemoved, tojson(res));
- };
-
- $config.data.nolock = false;
-
- // scale down threadCount and iterations because eval takes a global lock
- $config.threadCount = 5;
- $config.iterations = 10;
-
- return $config;
-});
diff --git a/jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js b/jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
deleted file mode 100644
index a3f67c26892..00000000000
--- a/jstests/concurrency/fsm_workloads/remove_single_document_eval_nolock.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-
-/**
- * remove_single_document_eval_nolock.js
- *
- * Runs remove_single_document_eval with the eval option { nolock: true }.
- */
-load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
-load('jstests/concurrency/fsm_workloads/remove_single_document_eval.js'); // for $config
-
-var $config = extendWorkload($config, function($config, $super) {
-
- $config.data.nolock = true;
-
- return $config;
-});
diff --git a/jstests/concurrency/fsm_workloads/update_simple_eval.js b/jstests/concurrency/fsm_workloads/update_simple_eval.js
deleted file mode 100644
index f8b9115e455..00000000000
--- a/jstests/concurrency/fsm_workloads/update_simple_eval.js
+++ /dev/null
@@ -1,33 +0,0 @@
-'use strict';
-
-/**
- * update_eval.js
- *
- * Creates several docs. On each iteration, each thread chooses:
- * - a random doc
- * - whether to $set or $unset its field
- * - what value to $set the field to
- * and then applies the update using db.runCommand({ eval: ... })
- */
-load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
-load('jstests/concurrency/fsm_workloads/update_simple.js'); // for $config
-
-var $config = extendWorkload($config, function($config, $super) {
-
- $config.data.doUpdate = function doUpdate(db, collName, query, updater) {
- var evalResult = db.runCommand({
- eval: function(f, collName, query, updater) {
- return tojson(f(db, collName, query, updater));
- },
- args: [$super.data.doUpdate, collName, query, updater],
- nolock: this.nolock
- });
- assertAlways.commandWorked(evalResult);
- var res = JSON.parse(evalResult.retval);
- return res;
- };
-
- $config.data.nolock = false;
-
- return $config;
-});
diff --git a/jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js b/jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
deleted file mode 100644
index c5f081088cd..00000000000
--- a/jstests/concurrency/fsm_workloads/update_simple_eval_nolock.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-
-/**
- * update_simple_eval_nolock.js
- *
- * Runs update_simple_eval with the eval option { nolock: true }.
- */
-load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload
-load('jstests/concurrency/fsm_workloads/update_simple_eval.js'); // for $config
-
-var $config = extendWorkload($config, function($config, $super) {
-
- $config.data.nolock = true;
-
- return $config;
-});
diff --git a/jstests/core/apitest_db.js b/jstests/core/apitest_db.js
index 478f0ef8f08..8d8eaf54822 100644
--- a/jstests/core/apitest_db.js
+++ b/jstests/core/apitest_db.js
@@ -18,7 +18,6 @@ dd("b");
* be sure the public collection API is complete
*/
assert(db.createCollection, "createCollection");
-assert(db.dbEval, "dbEval");
dd("c");
diff --git a/jstests/core/constructors.js b/jstests/core/constructors.js
index 4d6f8b498cc..27b0b7f7406 100644
--- a/jstests/core/constructors.js
+++ b/jstests/core/constructors.js
@@ -2,7 +2,6 @@
//
// @tags: [
// does_not_support_stepdowns,
-// requires_eval_command,
// requires_non_retryable_commands,
// ]
@@ -37,24 +36,6 @@ function clientEvalConstructorTest(constructorList) {
});
}
-function dbEvalConstructorTest(constructorList) {
- assert.writeOK(db.evalConstructors.insert({}), "db must exist for eval to succeed");
- assert(db.evalConstructors.drop());
- constructorList = addConstructorsWithNew(constructorList);
- constructorList.valid.forEach(function(constructor) {
- try {
- db.eval(constructor);
- } catch (e) {
- throw("valid constructor: " + constructor + " failed in db.eval context: " + e);
- }
- });
- constructorList.invalid.forEach(function(constructor) {
- assert.throws(function() {
- db.eval(constructor);
- }, [], "invalid constructor did not throw error in db.eval context: " + constructor);
- });
-}
-
function mapReduceConstructorTest(constructorList) {
constructorList = addConstructorsWithNew(constructorList);
t = db.mr_constructors;
@@ -290,16 +271,6 @@ clientEvalConstructorTest(md5Constructors);
clientEvalConstructorTest(hexdataConstructors);
clientEvalConstructorTest(dateConstructors);
-dbEvalConstructorTest(dbrefConstructors);
-dbEvalConstructorTest(dbpointerConstructors);
-dbEvalConstructorTest(objectidConstructors);
-dbEvalConstructorTest(timestampConstructors);
-dbEvalConstructorTest(bindataConstructors);
-dbEvalConstructorTest(uuidConstructors);
-dbEvalConstructorTest(md5Constructors);
-dbEvalConstructorTest(hexdataConstructors);
-dbEvalConstructorTest(dateConstructors);
-
mapReduceConstructorTest(dbrefConstructors);
mapReduceConstructorTest(dbpointerConstructors);
mapReduceConstructorTest(objectidConstructors);
diff --git a/jstests/core/error2.js b/jstests/core/error2.js
index 6674d5663c6..d9c2fdf7f63 100644
--- a/jstests/core/error2.js
+++ b/jstests/core/error2.js
@@ -1,6 +1,5 @@
// Test that client gets stack trace on failed invoke
// @tags: [
-// requires_eval_command,
// requires_non_retryable_commands,
// ]
@@ -18,9 +17,3 @@ assert.throws(function() {
});
c.next();
});
-
-assert.throws(function() {
- db.eval(function() {
- return a();
- });
-});
diff --git a/jstests/core/eval0.js b/jstests/core/eval0.js
deleted file mode 100644
index 921c4b4b428..00000000000
--- a/jstests/core/eval0.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// @tags: [
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-assert.writeOK(db.evalprep.insert({}), "db must exist for eval to succeed");
-
-db.evalprep.drop();
-db.system.js.remove({});
-
-assert.eq(17,
- db.eval(function() {
- return 11 + 6;
- }),
- "A");
-assert.eq(17, db.eval(function(x) {
- return 10 + x;
-}, 7), "B");
-
-// check that functions in system.js work
-assert.writeOK(db.system.js.insert({
- _id: "add",
- value: function(x, y) {
- return x + y;
- }
-}));
-
-assert.eq(20, db.eval("this.add(15, 5);"), "C");
diff --git a/jstests/core/eval1.js b/jstests/core/eval1.js
deleted file mode 100644
index fca8ef7c0ec..00000000000
--- a/jstests/core/eval1.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.eval1;
-t.drop();
-
-t.save({_id: 1, name: "eliot"});
-t.save({_id: 2, name: "sara"});
-
-f = function(id) {
- return db["eval1"].findOne({_id: id}).name;
-};
-
-assert.eq("eliot", f(1), "A");
-assert.eq("sara", f(2), "B");
-assert.eq("eliot", db.eval(f, 1), "C");
-assert.eq("sara", db.eval(f, 2), "D");
diff --git a/jstests/core/eval3.js b/jstests/core/eval3.js
deleted file mode 100644
index ac0f381c9ca..00000000000
--- a/jstests/core/eval3.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// requires_fastcount,
-// ]
-
-t = db.eval3;
-t.drop();
-
-t.save({_id: 1, name: "eliot"});
-assert.eq(1, t.count(), "A");
-
-function z(a, b) {
- db.eval3.save({_id: a, name: b});
- return b;
-}
-
-z(2, "sara");
-assert.eq(2, t.count(), "B");
-
-assert.eq("eliot,sara",
- t.find()
- .toArray()
- .map(function(z) {
- return z.name;
- })
- .sort()
- .toString());
-
-assert.eq("joe", db.eval(z, 3, "joe"), "C");
-assert.eq(3, t.count(), "D");
-
-assert.eq("eliot,joe,sara",
- t.find()
- .toArray()
- .map(function(z) {
- return z.name;
- })
- .sort()
- .toString());
diff --git a/jstests/core/eval4.js b/jstests/core/eval4.js
deleted file mode 100644
index 375cb66b182..00000000000
--- a/jstests/core/eval4.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// requires_non_retryable_writes,
-// requires_fastcount,
-// ]
-
-t = db.eval4;
-t.drop();
-
-t.save({a: 1});
-t.save({a: 2});
-t.save({a: 3});
-
-assert.eq(3, t.count(), "A");
-
-function f(x) {
- db.eval4.remove({a: x});
-}
-
-f(2);
-assert.eq(2, t.count(), "B");
-
-db.eval(f, 2);
-assert.eq(2, t.count(), "C");
-
-db.eval(f, 3);
-assert.eq(1, t.count(), "D");
diff --git a/jstests/core/eval5.js b/jstests/core/eval5.js
deleted file mode 100644
index f3d30c49779..00000000000
--- a/jstests/core/eval5.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.eval5;
-t.drop();
-
-t.save({a: 1, b: 2, c: 3});
-
-assert.eq(3,
- db.eval(function(z) {
- return db.eval5.find().toArray()[0].c;
- }),
- "something weird A");
-
-assert.isnull(db.eval(function(z) {
- return db.eval5.find({}, {a: 1}).toArray()[0].c;
-}),
- "field spec didn't work");
diff --git a/jstests/core/eval6.js b/jstests/core/eval6.js
deleted file mode 100644
index d8ad52e95d5..00000000000
--- a/jstests/core/eval6.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.eval6;
-t.drop();
-
-t.save({a: 1});
-
-db.eval(function() {
- o = db.eval6.findOne();
- o.b = 2;
- db.eval6.save(o);
-});
-
-assert.eq(2, t.findOne().b);
diff --git a/jstests/core/eval7.js b/jstests/core/eval7.js
deleted file mode 100644
index 751779dba29..00000000000
--- a/jstests/core/eval7.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// @tags: [
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-assert.writeOK(db.evalprep.insert({}), "db must exist for eval to succeed");
-db.evalprep.drop();
-
-assert.eq(6, db.eval("5 + 1"), "A");
-assert.throws(function(z) {
- db.eval("5 + function x; + 1");
-});
diff --git a/jstests/core/eval8.js b/jstests/core/eval8.js
deleted file mode 100644
index 24f710f4b9f..00000000000
--- a/jstests/core/eval8.js
+++ /dev/null
@@ -1,22 +0,0 @@
-
-t = db.eval8;
-t.drop();
-
-x = {
- a: 1,
- b: 2
-};
-t.save(x);
-x = t.findOne();
-
-assert(x.a && x.b, "A");
-delete x.b;
-
-assert(x.a && !x.b, "B");
-x.b = 3;
-assert(x.a && x.b, "C");
-assert.eq(3, x.b, "D");
-
-t.save(x);
-y = t.findOne();
-assert.eq(tojson(x), tojson(y), "E");
diff --git a/jstests/core/eval9.js b/jstests/core/eval9.js
deleted file mode 100644
index ce6f909dd2f..00000000000
--- a/jstests/core/eval9.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-assert.writeOK(db.evalprep.insert({}), "db must exist for eval to succeed");
-db.evalprep.drop();
-
-a = [1, "asd", null, [2, 3], new Date(), {x: 1}];
-
-for (var i = 0; i < a.length; i++) {
- var ret = db.eval("function( a , i ){ return a[i]; }", a, i);
- assert.eq(typeof(a[i]), typeof(ret), "type test");
- assert.eq(a[i], ret, "val test: " + typeof(a[i]));
-}
-
-db.eval9.drop();
-db.eval9.save({a: 17});
-
-assert.eq(1, db.eval("return db.eval9.find().toArray()").length, "A");
-assert.eq(17, db.eval("return db.eval9.find().toArray()")[0].a, "B");
-
-// just to make sure these things don't crash (but may throw an exception)
-try {
- db.eval("return db.eval9.find()");
- db.eval("return db.eval9");
- db.eval("return db");
- db.eval("return print");
-} catch (ex) {
-}
diff --git a/jstests/core/eval_mr.js b/jstests/core/eval_mr.js
deleted file mode 100644
index 33b56039321..00000000000
--- a/jstests/core/eval_mr.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Test that the eval command can't be used to invoke the mapReduce command. SERVER-17889.
-//
-// @tags: [
-// # Cannot implicitly shard accessed collections because of following errmsg: Cannot output to a
-// # non-sharded collection because sharded collection exists already.
-// assumes_unsharded_collection,
-// does_not_support_stepdowns,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-(function() {
- "use strict";
- db.eval_mr.drop();
- db.eval_mr_out.drop();
- assert.writeOK(db.eval_mr.insert({val: 1}));
- assert.writeOK(db.eval_mr.insert({val: 2}));
- var runBasicMapReduce = function() {
- return db.eval_mr.runCommand("mapReduce", {
- map: function() {
- emit(0, this.val);
- },
- reduce: function(id, values) {
- return Array.sum(values);
- },
- out: {replace: "eval_mr_out"}
- });
- };
- assert.commandWorked(runBasicMapReduce());
- assert.eq(3, db.eval_mr_out.findOne().value);
- assert.commandFailed(db.eval(runBasicMapReduce));
-})();
diff --git a/jstests/core/eval_nolock.js b/jstests/core/eval_nolock.js
deleted file mode 100644
index 8ff0738110e..00000000000
--- a/jstests/core/eval_nolock.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.eval_nolock;
-t.drop();
-
-for (i = 0; i < 10; i++)
- t.insert({_id: i});
-
-res = db.runCommand({
- eval: function() {
- db.eval_nolock.insert({_id: 123});
- return db.eval_nolock.count();
- },
- nolock: true
-});
-
-assert.eq(11, res.retval, "A");
diff --git a/jstests/core/eval_wait_for_read_write_concern.js b/jstests/core/eval_wait_for_read_write_concern.js
deleted file mode 100644
index cfa90878151..00000000000
--- a/jstests/core/eval_wait_for_read_write_concern.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// Ensures db eval does not crash when attempt is made to wait on a replicated read/write concern
-// (function() {
-// 'use strict';
-
-// // Read concern
-// var findCommand = {find: 'readMajority', batchSize: 2, readConcern: {level: 'majority'}};
-// db.runCommand({'eval': 'db.runCommand(' + tojson(findCommand) + ')'});
-
-// // Write concern
-// var insertCommand = {
-// insert: 'writeConcern',
-// documents: [{TestKey: 'TestValue'}],
-// writeConcern: {w: 'majority', wtimeout: 30000}
-// };
-// db.runCommand({'eval': 'db.runCommand(' + tojson(insertCommand) + ')'});
-// })();
diff --git a/jstests/core/evala.js b/jstests/core/evala.js
deleted file mode 100644
index 2d3187fdcc1..00000000000
--- a/jstests/core/evala.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.evala;
-t.drop();
-
-t.save({x: 5});
-
-assert.eq(5, db.eval("function(){ return db.evala.findOne().x; }"), "A");
-assert.eq(5, db.eval("/* abc */function(){ return db.evala.findOne().x; }"), "B");
diff --git a/jstests/core/evalb.js b/jstests/core/evalb.js
deleted file mode 100644
index 2e57d1046b6..00000000000
--- a/jstests/core/evalb.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// Check the return value of a db.eval function running a database query, and ensure the function's
-// contents are logged in the profile log.
-//
-// @tags: [
-// assumes_read_preference_unchanged,
-// creates_and_authenticates_user,
-// does_not_support_stepdowns,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// requires_profiling
-// ]
-
-// Use a reserved database name to avoid a conflict in the parallel test suite.
-var stddb = db;
-var db = db.getSisterDB('evalb');
-
-function profileCursor() {
- return db.system.profile.find({user: username + "@" + db.getName()});
-}
-
-function lastOp() {
- return profileCursor().sort({$natural: -1}).next();
-}
-
-try {
- username = 'jstests_evalb_user';
- db.dropUser(username);
- db.createUser({user: username, pwd: 'password', roles: jsTest.basicUserRoles});
- db.auth(username, 'password');
-
- t = db.evalb;
- t.drop();
-
- t.save({x: 3});
-
- assert.eq(3,
- db.eval(function() {
- return db.evalb.findOne().x;
- }),
- 'A');
-
- db.setProfilingLevel(2);
-
- assert.eq(3,
- db.eval(function() {
- return db.evalb.findOne().x;
- }),
- 'B');
-
- o = lastOp();
- assert(tojson(o).indexOf('findOne().x') > 0, 'C : ' + tojson(o));
-} finally {
- db.setProfilingLevel(0);
- db = stddb;
-}
diff --git a/jstests/core/evald.js b/jstests/core/evald.js
deleted file mode 100644
index bb81d08dfb0..00000000000
--- a/jstests/core/evald.js
+++ /dev/null
@@ -1,105 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// does_not_support_stepdowns,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.jstests_evald;
-t.drop();
-
-function debug(x) {
- // printjson( x );
-}
-
-for (i = 0; i < 10; ++i) {
- t.save({i: i});
-}
-
-function op(ev, where) {
- p = db.currentOp().inprog;
- debug(p);
- for (var i in p) {
- var o = p[i];
- if (where) {
- if (o.active && o.command && o.command.query && o.command.query.$where &&
- o.ns == "test.jstests_evald") {
- return o.opid;
- }
- } else {
- if (o.active && o.command && o.command.$eval && o.command.$eval == ev) {
- return o.opid;
- }
- }
- }
- return -1;
-}
-
-function doIt(ev, wait, where) {
- var awaitShell;
-
- if (where) {
- awaitShell = startParallelShell(ev);
- } else {
- awaitShell = startParallelShell("db.eval( '" + ev + "' )");
- }
-
- o = null;
- assert.soon(function() {
- o = op(ev, where);
- return o != -1;
- });
-
- if (wait) {
- sleep(2000);
- }
-
- debug("going to kill");
-
- db.killOp(o);
-
- debug("sent kill");
-
- var exitCode = awaitShell({checkExitSuccess: false});
- assert.neq(
- 0, exitCode, "expected shell to exit abnormally due to JS execution being terminated");
-}
-
-// nested scope with nested invoke()
-doIt("db.jstests_evald.count( { $where: function() { while(1) { sleep(1); } } } )", true, true);
-doIt("db.jstests_evald.count( { $where: function() { while(1) { sleep(1); } } } )", false, true);
-
-// simple tight loop tests with callback
-doIt("while(1) { sleep(1); }", false);
-doIt("while(1) { sleep(1); }", true);
-
-// simple tight loop tests without callback
-doIt("while(1) {;}", false);
-doIt("while(1) {;}", true);
-
-// the for loops are currently required, as a spawned op masks the parent op - see SERVER-1931
-doIt("while(1) { for( var i = 0; i < 10000; ++i ) {;} db.jstests_evald.count({i:10}); }", true);
-doIt("while(1) { for( var i = 0; i < 10000; ++i ) {;} db.jstests_evald.count({i:10}); }", false);
-doIt("while(1) { for( var i = 0; i < 10000; ++i ) {;} db.jstests_evald.count(); }", true);
-doIt("while(1) { for( var i = 0; i < 10000; ++i ) {;} db.jstests_evald.count(); }", false);
-
-// try/catch with tight-loop kill tests.
-// native callback with nested invoke(), drop JS exceptions
-doIt("while(1) { " +
- " for(var i = 0; i < 10000; ++i) {;} " +
- " try { " +
- " db.jstests_evald.count({i:10}); " +
- " } catch (e) {} " + "}",
- true);
-
-// native callback, drop JS exceptions
-doIt("while(1) { " + " try { " + " while(1) { " +
- " sleep(1); " + " } " + " } catch (e) {} " + "}",
- true);
-
-// no native callback and drop JS exceptions
-doIt("while(1) { " + " try { " + " while(1) {;} " +
- " } catch (e) {} " + "}",
- true);
diff --git a/jstests/core/evale.js b/jstests/core/evale.js
deleted file mode 100644
index 659b83fd339..00000000000
--- a/jstests/core/evale.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.jstests_evale;
-t.drop();
-
-db.eval(function() {
- return db.jstests_evale.count({
- $where: function() {
- return true;
- }
- });
-});
-db.eval("db.jstests_evale.count( { $where:function() { return true; } } )");
diff --git a/jstests/core/evalg.js b/jstests/core/evalg.js
deleted file mode 100644
index 536fdcadb81..00000000000
--- a/jstests/core/evalg.js
+++ /dev/null
@@ -1,19 +0,0 @@
-// SERVER-17499: Test behavior of getMore on aggregation cursor under eval command.
-//
-// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-db.evalg.drop();
-for (var i = 0; i < 102; ++i) {
- db.evalg.insert({});
-}
-assert.eq(102, db.eval(function() {
- var cursor = db.evalg.aggregate();
- assert(cursor.hasNext());
- assert.eq(101, cursor.objsLeftInBatch());
- return cursor.itcount();
-}));
diff --git a/jstests/core/evalh.js b/jstests/core/evalh.js
deleted file mode 100644
index 31ea47ce891..00000000000
--- a/jstests/core/evalh.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Test that db.eval does not support auth.
- *
- * @tags: [
- * requires_eval_command,
- * requires_non_retryable_commands,
- * ]
- */
-(function() {
- 'use strict';
-
- assert.writeOK(db.evalprep.insert({}), "db must exist for eval to succeed");
- db.evalprep.drop();
-
- // The db.auth method call getMongo().auth but catches the exception.
- assert.eq(0, db.eval('db.auth("reader", "reader")'));
-
- // Call the native implementation auth function and verify it does not exist under the db.eval
- // javascript context.
- assert.throws(function() {
- db.eval('db.getMongo().auth("reader", "reader")');
- });
-})();
diff --git a/jstests/core/evalj.js b/jstests/core/evalj.js
deleted file mode 100644
index e58adf3c040..00000000000
--- a/jstests/core/evalj.js
+++ /dev/null
@@ -1,18 +0,0 @@
-// @tags: [
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-(function() {
- "use strict";
-
- db.col.insert({data: 5});
-
- db.eval("print(5)");
-
- db.system.js.insert({_id: "foo", value: Code("db.col.drop()")});
-
- db.eval("print(5)");
-
- assert.eq(5, db.col.findOne()["data"]);
-})();
diff --git a/jstests/core/fsync.js b/jstests/core/fsync.js
index 330767cf03a..2f116364c34 100644
--- a/jstests/core/fsync.js
+++ b/jstests/core/fsync.js
@@ -5,9 +5,8 @@
* - Confirm that we cannot insert during fsyncLock
* - Confirm that writes can progress after fsyncUnlock
* - Confirm that the command can be run repeatedly without breaking things
- * - Confirm that the pseudo commands and eval can perform fsyncLock/Unlock
*
- * @tags: [requires_eval_command, requires_fastcount]
+ * @tags: [requires_fastcount, requires_fsync]
*/
(function() {
"use strict";
@@ -77,9 +76,6 @@
var fsyncUnlockRes = db.fsyncUnlock();
assert(fsyncUnlockRes.ok, "Second execution of fsyncUnlock command failed");
- // Ensure eval is not allowed to invoke fsyncLock
- assert(!db.eval('db.fsyncLock()').ok, "eval('db.fsyncLock()') should fail.");
-
// Make sure that insert attempts made during multiple fsyncLock requests will not execute until
// all locks have been released.
fsyncLockRes = db.fsyncLock();
diff --git a/jstests/core/function_string_representations.js b/jstests/core/function_string_representations.js
index 211733e88fb..448bc8321b8 100644
--- a/jstests/core/function_string_representations.js
+++ b/jstests/core/function_string_representations.js
@@ -34,7 +34,6 @@
whereFunction += ";";
assert.eq(1, col.find({$where: whereFunction}).itcount());
- // db.eval does not need to be tested, as it accepts code fragments, not functions.
// system.js does not need to be tested, as its contents types' are preserved, and
// strings are not promoted into functions.
})();
diff --git a/jstests/core/js3.js b/jstests/core/js3.js
index d9c0374360c..b5ad9ae03fd 100644
--- a/jstests/core/js3.js
+++ b/jstests/core/js3.js
@@ -1,8 +1,6 @@
// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
// assumes_unsharded_collection,
-// requires_eval_command,
+// requires_javascript,
// requires_non_retryable_commands,
// requires_fastcount,
// ]
@@ -29,21 +27,12 @@ for (z = 0; z < 2; z++) {
z: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
});
- assert(33 == db.dbEval(function() {
- return 33;
- }));
-
- db.dbEval(function() {
- db.jstests_js3.save({i: -1, z: "server side"});
- });
-
- assert(t.findOne({i: -1}));
-
assert(2 == t.find({
$where: function() {
return obj.i == 7 || obj.i == 8;
}
}).length());
+ assert.eq(1000, t.count());
// NPE test
var ok = false;
@@ -82,11 +71,11 @@ for (z = 0; z < 2; z++) {
z: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
});
- assert(t.find().count() == 2001);
+ assert(t.find().count() == 2000);
assert(t.validate().valid);
debug("done iter");
}
-t.drop(); \ No newline at end of file
+t.drop();
diff --git a/jstests/core/js7.js b/jstests/core/js7.js
deleted file mode 100644
index a9f0f703c30..00000000000
--- a/jstests/core/js7.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// @tags: [
-// requires_eval_command,
-// requires_non_retryable_commands,
-// ]
-
-t = db.jstests_js7;
-t.drop();
-
-assert.eq(17, db.eval(function(foo) {
- return foo;
-}, 17));
diff --git a/jstests/core/js9.js b/jstests/core/js9.js
index 0b9278a7d12..ec385475e1e 100644
--- a/jstests/core/js9.js
+++ b/jstests/core/js9.js
@@ -1,8 +1,4 @@
// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
// requires_non_retryable_commands,
// requires_fastcount,
// ]
@@ -15,11 +11,4 @@ c.save({a: 2});
assert.eq(2, c.find().length());
assert.eq(2, c.find().count());
-
-assert.eq(2, db.eval(function() {
- num = 0;
- db.jstests_js9.find().forEach(function(z) {
- num++;
- });
- return num;
-}));
+assert.eq(2, c.find().itcount());
diff --git a/jstests/core/json_schema/misc_validation.js b/jstests/core/json_schema/misc_validation.js
index c8f5fcaf54b..5a126993902 100644
--- a/jstests/core/json_schema/misc_validation.js
+++ b/jstests/core/json_schema/misc_validation.js
@@ -15,9 +15,9 @@
*
* @tags: [
* assumes_no_implicit_collection_creation_after_drop,
- * requires_eval_command,
* requires_non_retryable_commands,
* requires_non_retryable_writes,
+ * requires_replication,
* ]
*/
(function() {
@@ -350,17 +350,5 @@
assert.commandWorked(res);
assert.eq(1, res.applied);
}
- // Test $jsonSchema in an eval function.
- assert.eq(1,
- testDB.eval(
- function(coll, schema) {
- return db[coll].find({$jsonSchema: schema}).itcount();
- },
- coll.getName(),
- {}));
-
- assert.eq(1, testDB.eval(function(coll, schema) {
- return db[coll].find({$jsonSchema: schema}).itcount();
- }, coll.getName(), {minProperties: 2}));
}
}());
diff --git a/jstests/core/recursion.js b/jstests/core/recursion.js
index 0114b72515c..6f6e5c906af 100644
--- a/jstests/core/recursion.js
+++ b/jstests/core/recursion.js
@@ -3,7 +3,6 @@
//
// @tags: [
// does_not_support_stepdowns,
-// requires_eval_command,
// requires_non_retryable_commands,
// ]
@@ -18,17 +17,6 @@
}
assert.throws(shellRecursion);
- // Make sure db.eval doesn't blow up
- function dbEvalRecursion() {
- db.eval(function() {
- function recursion() {
- recursion.apply();
- }
- recursion();
- });
- }
- assert.commandFailedWithCode(assert.throws(dbEvalRecursion), ErrorCodes.JSInterpreterFailure);
-
// Make sure mapReduce doesn't blow up
function mapReduceRecursion() {
db.recursion.mapReduce(
diff --git a/jstests/core/remove8.js b/jstests/core/remove8.js
index 4dd68fd186d..7a8263c21e4 100644
--- a/jstests/core/remove8.js
+++ b/jstests/core/remove8.js
@@ -1,8 +1,4 @@
// @tags: [
-// # Cannot implicitly shard accessed collections because unsupported use of sharded collection
-// # from db.eval.
-// assumes_unsharded_collection,
-// requires_eval_command,
// requires_non_retryable_commands,
// requires_non_retryable_writes,
// requires_fastcount,
@@ -26,7 +22,5 @@ assert.eq(0, t.count(), "B");
fill();
assert.eq(N, t.count(), "C");
-db.eval(function() {
- db.remove8.remove({});
-});
+t.remove({});
assert.eq(0, t.count(), "D");
diff --git a/jstests/core/rename4.js b/jstests/core/rename4.js
index e1e9dbe2a9b..32f48f9cd0f 100644
--- a/jstests/core/rename4.js
+++ b/jstests/core/rename4.js
@@ -1,5 +1,4 @@
// @tags: [
-// requires_eval_command,
// requires_non_retryable_commands,
// ]
diff --git a/jstests/core/storefunc.js b/jstests/core/storefunc.js
index 44b27802565..8f6eca7a574 100644
--- a/jstests/core/storefunc.js
+++ b/jstests/core/storefunc.js
@@ -1,5 +1,4 @@
// @tags: [
-// requires_eval_command,
// requires_non_retryable_commands,
// requires_non_retryable_writes,
// requires_fastcount,
@@ -29,39 +28,9 @@ s.update({_id: "x"}, {$set: {value: 5}});
assert.eq(1, s.count(), "setup - G");
assert.eq(5, s.findOne().value, "setup - H");
-assert.eq(5, testdb.eval("return x"), "exec - 1 ");
-
s.update({_id: "x"}, {$set: {value: 6}});
assert.eq(1, s.count(), "setup2 - A");
assert.eq(6, s.findOne().value, "setup - B");
-assert.eq(6, testdb.eval("return x"), "exec - 2 ");
-
-s.insert({
- _id: "bar",
- value: function(z) {
- return 17 + z;
- }
-});
-assert.eq(22, testdb.eval("return bar(5);"), "exec - 3 ");
-
assert(s.getIndexKeys().length > 0, "no indexes");
assert(s.getIndexKeys()[0]._id, "no _id index");
-
-assert.eq("undefined",
- testdb.eval(function() {
- return typeof(zzz);
- }),
- "C1");
-s.save({_id: "zzz", value: 5});
-assert.eq("number",
- testdb.eval(function() {
- return typeof(zzz);
- }),
- "C2");
-s.remove({_id: "zzz"});
-assert.eq("undefined",
- testdb.eval(function() {
- return typeof(zzz);
- }),
- "C3");
diff --git a/jstests/core/txns/commands_not_allowed_in_txn.js b/jstests/core/txns/commands_not_allowed_in_txn.js
index 62e285bbdbd..a38b4c4c0aa 100644
--- a/jstests/core/txns/commands_not_allowed_in_txn.js
+++ b/jstests/core/txns/commands_not_allowed_in_txn.js
@@ -94,8 +94,6 @@
{count: collName, query: {a: 1}},
{applyOps: [{op: "u", ns: testColl.getFullName(), o2: {_id: 0}, o: {$set: {a: 5}}}]},
{explain: {find: collName}},
- {eval: "function() {return 1;}"},
- {"$eval": "function() {return 1;}"},
{filemd5: 1, root: "fs"},
{mapReduce: collName, map: function() {}, reduce: function(key, vals) {}, out: "out"},
{parallelCollectionScan: collName, numCursors: 1},
diff --git a/jstests/core/txns/statement_ids_accepted.js b/jstests/core/txns/statement_ids_accepted.js
index fa4e7088839..790e690a82d 100644
--- a/jstests/core/txns/statement_ids_accepted.js
+++ b/jstests/core/txns/statement_ids_accepted.js
@@ -91,24 +91,6 @@
// The doTxn command is intentionally left out.
- jsTestLog("Check that eval accepts a statement ID");
- assert.commandWorked(sessionDb.runCommand({
- eval: function() {
- return 0;
- },
- txnNumber: NumberLong(txnNumber++),
- stmtId: NumberInt(0),
- }));
-
- jsTestLog("Check that $eval accepts a statement ID");
- assert.commandWorked(sessionDb.runCommand({
- $eval: function() {
- return 0;
- },
- txnNumber: NumberLong(txnNumber++),
- stmtId: NumberInt(0),
- }));
-
jsTestLog("Check that explain accepts a statement ID");
assert.commandWorked(sessionDb.runCommand({
explain: {
diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js
index 2867787a272..261c570aa5f 100644
--- a/jstests/core/views/views_all_commands.js
+++ b/jstests/core/views/views_all_commands.js
@@ -237,7 +237,6 @@
},
enableSharding: {skip: "Tested as part of shardCollection"},
endSessions: {skip: isUnrelated},
- eval: {skip: isUnrelated},
explain: {command: {explain: {count: "view"}}},
features: {skip: isUnrelated},
filemd5: {skip: isUnrelated},
diff --git a/jstests/libs/override_methods/auto_retry_on_network_error.js b/jstests/libs/override_methods/auto_retry_on_network_error.js
index 842a6104047..fffdccfc4d3 100644
--- a/jstests/libs/override_methods/auto_retry_on_network_error.js
+++ b/jstests/libs/override_methods/auto_retry_on_network_error.js
@@ -93,10 +93,6 @@
"revokeRolesFromUser",
"updateRole",
"updateUser",
-
- // Other commands.
- "eval", // May contain non-retryable commands.
- "$eval",
]);
// These commands are not idempotent because they return errors if retried after
diff --git a/jstests/libs/override_methods/set_read_and_write_concerns.js b/jstests/libs/override_methods/set_read_and_write_concerns.js
index d120ce08734..e5143901997 100644
--- a/jstests/libs/override_methods/set_read_and_write_concerns.js
+++ b/jstests/libs/override_methods/set_read_and_write_concerns.js
@@ -120,12 +120,6 @@
commandName = Object.keys(commandObjUnwrapped)[0];
}
- if (commandName === "eval" || commandName === "$eval") {
- throw new Error("Cowardly refusing to run test with overridden write concern when it" +
- " uses a command that can only perform w=1 writes: " +
- tojson(commandObj));
- }
-
let shouldForceReadConcern = kCommandsSupportingReadConcern.has(commandName);
let shouldForceWriteConcern = kCommandsSupportingWriteConcern.has(commandName);
diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js
index 59f9b43f74d..90cfc4535a7 100644
--- a/jstests/libs/parallelTester.js
+++ b/jstests/libs/parallelTester.js
@@ -248,7 +248,6 @@ if (typeof _threadInject != "undefined") {
// databases, with the exception of tests which modify slowms or the profiler's sampling
// rate, since those affect profile settings globally.
parallelFilesDir + "/apitest_db_profile_level.js",
- parallelFilesDir + "/evalb.js",
parallelFilesDir + "/geo_s2cursorlimitskip.js",
parallelFilesDir + "/profile1.js",
parallelFilesDir + "/profile2.js",
diff --git a/jstests/noPassthrough/implicit_sessions.js b/jstests/noPassthrough/implicit_sessions.js
index 350571164b9..887da75101f 100644
--- a/jstests/noPassthrough/implicit_sessions.js
+++ b/jstests/noPassthrough/implicit_sessions.js
@@ -199,30 +199,6 @@
MongoRunner.stopMongod(conn);
}
- // Tests for the shell parameter, and the function that exposes it, for disabling implicit
- // sessions.
- function runTestGlobalFlag() {
- const conn = MongoRunner.runMongod();
- const testDB = conn.getDB("test");
-
- // The native disabled function should return false in the mongo shell by default.
- assert(_shouldUseImplicitSessions());
-
- // Commands run in eval should never use implicit sessions.
- const evalFunc = function() {
- assert(!_shouldUseImplicitSessions(),
- "expected implicit sessions to be disabled inside eval");
-
- inspectCommandForSessionId(function() {
- assert.writeOK(db.foo.insert({x: 1}));
- }, {shouldIncludeId: false});
- };
- testDB.eval("inspectCommandForSessionId = " + inspectCommandForSessionId.toString() +
- "; (" + evalFunc.toString() + ")()");
-
- MongoRunner.stopMongod(conn);
- }
-
// Tests behavior of implicit sessions when they are disabled via a test flag.
function runTestDisabled() {
const conn = MongoRunner.runMongod();
@@ -258,7 +234,7 @@
runTestTransitionToDisabled();
- runTestGlobalFlag();
+ assert(_shouldUseImplicitSessions());
TestData.disableImplicitSessions = true;
runTestDisabled();
diff --git a/jstests/noPassthrough/low_js_heap_limit.js b/jstests/noPassthrough/low_js_heap_limit.js
index 4f4245df6f6..7ef5d99d583 100644
--- a/jstests/noPassthrough/low_js_heap_limit.js
+++ b/jstests/noPassthrough/low_js_heap_limit.js
@@ -8,8 +8,9 @@
assert.commandWorked(db.adminCommand({setParameter: 1, jsHeapLimitMB: 1}));
- assert.commandFailedWithCode(db.runCommand({$eval: 'sleep(10000);'}),
- ErrorCodes.ExceededMemoryLimit);
+ db.foo.insert({x: 1});
+ const e = assert.throws(() => db.foo.findOne({$where: 'sleep(10000);'}));
+ assert.eq(e.code, ErrorCodes.ExceededMemoryLimit);
var returnCode = runProgram("mongo", "--jsHeapLimitMB=1", "--nodb", "--eval='exit();'");
assert.eq(returnCode, 1);
diff --git a/jstests/noPassthrough/shell_cmd_assertions.js b/jstests/noPassthrough/shell_cmd_assertions.js
index 4510a6888a1..9c83339516f 100644
--- a/jstests/noPassthrough/shell_cmd_assertions.js
+++ b/jstests/noPassthrough/shell_cmd_assertions.js
@@ -197,27 +197,6 @@
res, [ErrorCodes.JSInterpreterFailure, kFakeErrCode]));
});
- tests.push(function errObject() {
- // Some functions throw an Error with a code property attached.
- let threw = false;
- let res = null;
- try {
- db.eval("this is a syntax error");
- } catch (e) {
- threw = true;
- res = e;
- }
- assert(threw);
- assert(res instanceof Error);
- assert(res.hasOwnProperty("code"));
- assert.throws(() => assert.commandWorked(res));
- assert.throws(() => assert.commandWorkedIgnoringWriteErrors(res));
- assert.doesNotThrow(() => assert.commandFailed(res));
- assert.doesNotThrow(() => assert.commandFailedWithCode(res, ErrorCodes.InternalError));
- assert.doesNotThrow(
- () => assert.commandFailedWithCode(res, [ErrorCodes.InternalError, kFakeErrCode]));
- });
-
tests.push(function crudInsertOneOk() {
const res = db.coll.insertOne({_id: 2});
assert(res.hasOwnProperty("acknowledged"));
diff --git a/jstests/noPassthroughWithMongod/eval_with_godinsert.js b/jstests/noPassthroughWithMongod/eval_with_godinsert.js
deleted file mode 100644
index 7e39438f23b..00000000000
--- a/jstests/noPassthroughWithMongod/eval_with_godinsert.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// Test for SERVER-26911. Executing a godinsert and a findAndModify in the same eval should not
-// crash the server.
-(function() {
- "use strict";
-
- db.jstests_server26911.drop();
-
- assert.writeOK(db.jstests_server26911.insert({_id: 0, a: 0}));
-
- const godinsertCmd =
- "assert.commandWorked(db.runCommand({godinsert: 'jstests_server26911', obj: {_id: 1}}));";
- const findAndModifyCmd = "db.jstests_server26911.findOneAndReplace({a: 0}, {a: 1});";
-
- assert.eq({_id: 0, a: 0}, db.eval(godinsertCmd + findAndModifyCmd));
-}()); \ No newline at end of file
diff --git a/jstests/parallel/checkMultiThread.js b/jstests/parallel/checkMultiThread.js
index 28aef1f96e7..a98b330dd9f 100644
--- a/jstests/parallel/checkMultiThread.js
+++ b/jstests/parallel/checkMultiThread.js
@@ -3,7 +3,7 @@ load('jstests/libs/parallelTester.js');
var start = new Date();
print("start: " + start);
var func = function() {
- db.runCommand({$eval: "sleep(10000);", nolock: true});
+ db.runCommand({sleep: 1, seconds: 10000});
return new Date();
};
a = new ScopedThread(func);
diff --git a/jstests/replsets/stepdown_kill_other_ops.js b/jstests/replsets/stepdown_kill_other_ops.js
index 71a40d509b3..a3de1e909b2 100644
--- a/jstests/replsets/stepdown_kill_other_ops.js
+++ b/jstests/replsets/stepdown_kill_other_ops.js
@@ -25,27 +25,22 @@
jsTestLog("Sleeping 30 seconds so the SECONDARY will be considered electable");
sleep(30000);
- // Run eval() in a separate thread to take the global write lock which would prevent stepdown
+ // Run sleep in a separate thread to take the global write lock which would prevent stepdown
// from completing if it failed to kill all running operations.
- jsTestLog("Running eval() to grab global write lock");
- var evalCmd = function() {
- var res = db.eval(function() {
- for (var i = 0; i < 60 * 10; i++) { // Run for 10 minutes if not interrupted.
- // Sleep in 1 second intervals so the javascript engine will notice when
- // it's killed
- sleep(1000);
- }
- });
- print("$eval completed without error. This shouldn't happen! Result: " + tojson(res));
+ jsTestLog("Running {sleep:1, lock: 'w'} to grab global write lock");
+ var sleepCmd = function() {
+ // Run for 10 minutes if not interrupted.
+ db.adminCommand({sleep: 1, lock: 'w', seconds: 60 * 10});
};
- var evalRunner = startParallelShell(evalCmd, primary.port);
+ const startTime = new Date().getTime() / 1000;
+ var sleepRunner = startParallelShell(sleepCmd, primary.port);
- jsTestLog("Confirming that eval() is running and has the global lock");
+ jsTestLog("Confirming that sleep() is running and has the global lock");
assert.soon(function() {
var res = primary.getDB('admin').currentOp();
for (var index in res.inprog) {
var entry = res.inprog[index];
- if (entry["command"] && entry["command"]["$eval"]) {
+ if (entry["command"] && entry["command"]["sleep"]) {
if ("W" === entry["locks"]["Global"]) {
return true;
}
@@ -53,7 +48,7 @@
}
printjson(res);
return false;
- }, "$eval never ran and grabbed the global write lock");
+ }, "sleep never ran and grabbed the global write lock");
jsTestLog("Stepping down");
try {
@@ -68,8 +63,12 @@
var newPrimary = replSet.getPrimary();
assert.neq(primary, newPrimary, "SECONDARY did not become PRIMARY");
- var exitCode = evalRunner({checkExitSuccess: false});
- assert.neq(
- 0, exitCode, "expected shell to exit abnormally due to JS execution being terminated");
+ sleepRunner({checkExitSuccess: false});
+ const endTime = new Date().getTime() / 1000;
+ const duration = endTime - startTime;
+ assert.lt(duration,
+ 60 * 9, // In practice, this should be well under 1 minute.
+ "Sleep lock held longer than expected, possibly uninterrupted.");
+
replSet.stopSet();
})();
diff --git a/jstests/serial_run/memory.js b/jstests/serial_run/memory.js
index 3451800b89d..f9b125b24a9 100644
--- a/jstests/serial_run/memory.js
+++ b/jstests/serial_run/memory.js
@@ -11,55 +11,39 @@ for (var i = 0; i < loopNum; ++i) {
name = "memoryTest" + i;
if ((i % 1000) == 0)
print("Processing " + name);
- db.eval(function(col) {
- for (var i = 0; i < 100; ++i) {
- db[col + "_" + i].find();
- }
- }, name);
-}
-
-// test recovery of JS engine after out of memory
-db.system.js.save({
- "_id": "f1",
- "value": function(n) {
- a = [];
- b = [];
- c = [];
- for (i = 0; i < n; i++) {
- a.push(Math.random());
- b.push(Math.random());
- c.push(Math.random());
- }
+ for (var j = 0; j < 100; ++j) {
+ db[name + "_" + j].find();
}
-});
+}
// do mix of calls to make sure OOM is handled with no permanent damage
-db.eval("f1(10)");
+function doWhereTest(count) {
+ 'use strict';
+ print('doWhereTest(' + count + ')');
+ const coll = db.whereCol;
+ coll.drop();
+ coll.insert({a: 1});
+ coll.findOne({$where: "var arr = []; for (var i = 0; i < " + count + "; ++i) {arr.push(0);}"});
+}
+
+doWhereTest(10);
assert.throws(function() {
- db.eval("f1(100000000)");
+ doWhereTest(1000000000);
});
-db.eval("f1(10)");
+doWhereTest(10);
assert.throws(function() {
- db.eval("f1(1000000000)");
+ doWhereTest(1000000000);
});
loopNum = codeCoverageVariant ? 10000 : 1000000;
-db.eval("f1(" + loopNum + ")");
-db.eval("f1(" + loopNum + ")");
-db.eval("f1(" + loopNum + ")");
+doWhereTest(loopNum);
+doWhereTest(loopNum);
+doWhereTest(loopNum);
assert.throws(function() {
- db.eval("f1(100000000)");
+ doWhereTest(1000000000);
});
-db.eval("f1(10)");
-db.eval("f1(" + loopNum + ")");
-db.eval("f1(" + loopNum + ")");
-db.eval("f1(" + loopNum + ")");
-// also test $where
-col.drop();
-col.insert({a: 1});
-col.findOne({$where: "var arr = []; for (var i = 0; i < " + loopNum + "; ++i) {arr.push(0);}"});
-assert.throws(function() {
- col.findOne({$where: "var arr = []; for (var i = 0; i < 1000000000; ++i) {arr.push(0);}"});
-});
-col.findOne({$where: "var arr = []; for (var i = 0; i < " + loopNum + "; ++i) {arr.push(0);}"});
+doWhereTest(10);
+doWhereTest(loopNum);
+doWhereTest(loopNum);
+doWhereTest(loopNum);
diff --git a/jstests/sharding/database_and_shard_versioning_all_commands.js b/jstests/sharding/database_and_shard_versioning_all_commands.js
index 46341ccdbc0..e85fff77e3a 100644
--- a/jstests/sharding/database_and_shard_versioning_all_commands.js
+++ b/jstests/sharding/database_and_shard_versioning_all_commands.js
@@ -199,17 +199,6 @@
echo: {skip: "does not forward command to primary shard"},
enableSharding: {skip: "does not forward command to primary shard"},
endSessions: {skip: "goes through the cluster write path"},
- eval: {
- sendsDbVersion: false,
- // It is a known bug that eval does not send shardVersion (SERVER-33357).
- sendsShardVersion: false,
- command: {
- eval: function(collName) {
- const doc = db[collName].findOne();
- },
- args: [collName]
- }
- },
explain: {skip: "TODO SERVER-31226"},
features: {skip: "executes locally on mongos (not sent to any remote node)"},
filemd5: {
diff --git a/jstests/sharding/features1.js b/jstests/sharding/features1.js
index ec2ae0b7068..f0494c8fe59 100644
--- a/jstests/sharding/features1.js
+++ b/jstests/sharding/features1.js
@@ -77,52 +77,6 @@
assert(s.admin.runCommand({shardcollection: "test.foo7", key: {num: 1}}).ok,
"shard with ok unique index");
- // ----- eval -----
-
- db.foo2.save({num: 5, a: 7});
- db.foo3.save({num: 5, a: 8});
-
- assert.eq(1, db.foo3.count(), "eval pre1");
- assert.eq(1, db.foo2.count(), "eval pre2");
-
- assert.eq(8,
- db.eval(function() {
- return db.foo3.findOne().a;
- }),
- "eval 1 ");
- assert.throws(function() {
- db.eval(function() {
- return db.foo2.findOne().a;
- });
- }, [], "eval 2");
-
- assert.eq(1,
- db.eval(function() {
- return db.foo3.count();
- }),
- "eval 3 ");
- assert.throws(function() {
- db.eval(function() {
- return db.foo2.count();
- });
- }, [], "eval 4");
-
- // ----- "eval" new command name SERVER-5588 -----
- var result;
- result = db.runCommand({
- eval: function() {
- return db.foo3.count();
- }
- }); // non-sharded collection
- assert.eq(1, result.ok, "eval should work for non-sharded collection in cluster");
-
- result = db.runCommand({
- eval: function() {
- return db.foo2.count();
- }
- }); // sharded collection
- assert.eq(0, result.ok, "eval should not work for sharded collection in cluster");
-
// ---- unique shard key ----
assert(s.admin.runCommand({shardcollection: "test.foo4", key: {num: 1}, unique: true}).ok,
diff --git a/jstests/sharding/safe_secondary_reads_drop_recreate.js b/jstests/sharding/safe_secondary_reads_drop_recreate.js
index 7f74a36d7c8..bddbd34c7d0 100644
--- a/jstests/sharding/safe_secondary_reads_drop_recreate.js
+++ b/jstests/sharding/safe_secondary_reads_drop_recreate.js
@@ -152,7 +152,6 @@
emptycapped: {skip: "primary only"},
enableSharding: {skip: "primary only"},
endSessions: {skip: "does not return user data"},
- eval: {skip: "primary only"},
explain: {skip: "TODO SERVER-30068"},
features: {skip: "does not return user data"},
filemd5: {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 2b9a44fb614..65a15332c52 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
@@ -176,7 +176,6 @@
emptycapped: {skip: "primary only"},
enableSharding: {skip: "primary only"},
endSessions: {skip: "does not return user data"},
- eval: {skip: "primary only"},
explain: {skip: "TODO SERVER-30068"},
features: {skip: "does not return user data"},
filemd5: {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 2750c52ff07..3a9cb7dfa87 100644
--- a/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js
+++ b/jstests/sharding/safe_secondary_reads_single_migration_waitForDelete.js
@@ -154,7 +154,6 @@
emptycapped: {skip: "primary only"},
enableSharding: {skip: "primary only"},
endSessions: {skip: "does not return user data"},
- eval: {skip: "primary only"},
explain: {skip: "TODO SERVER-30068"},
features: {skip: "does not return user data"},
filemd5: {skip: "does not return user data"},
diff --git a/src/mongo/bson/oid.h b/src/mongo/bson/oid.h
index 4474a12dbe2..a7187864b35 100644
--- a/src/mongo/bson/oid.h
+++ b/src/mongo/bson/oid.h
@@ -259,7 +259,7 @@ enum JsonStringFormat {
/** strict RFC format */
Strict,
/** 10gen format, which is close to JS format. This form is understandable by
- javascript running inside the Mongo server via eval() */
+ javascript running inside the Mongo server via $where, mr, etc... */
TenGen,
};
diff --git a/src/mongo/bson/util/builder.h b/src/mongo/bson/util/builder.h
index ccf4cd183fd..0362b987853 100644
--- a/src/mongo/bson/util/builder.h
+++ b/src/mongo/bson/util/builder.h
@@ -61,7 +61,6 @@ namespace mongo {
Also note that the server has some basic checks to enforce this limit but those checks are not
exhaustive for example need to check for size too big after
update $push (append) operation
- various db.eval() type operations
*/
const int BSONObjMaxUserSize = 16 * 1024 * 1024;
diff --git a/src/mongo/client/dbclient_base.cpp b/src/mongo/client/dbclient_base.cpp
index 2f756132c3f..d0ef3e0ea12 100644
--- a/src/mongo/client/dbclient_base.cpp
+++ b/src/mongo/client/dbclient_base.cpp
@@ -576,27 +576,6 @@ bool DBClientBase::copyDatabase(const string& fromdb,
return runCommand("admin", b.done(), *info);
}
-bool DBClientBase::eval(const string& dbname,
- const string& jscode,
- BSONObj& info,
- BSONElement& retValue,
- BSONObj* args) {
- BSONObjBuilder b;
- b.appendCode("$eval", jscode);
- if (args)
- b.appendArray("args", *args);
- bool ok = runCommand(dbname, b.done(), info);
- if (ok)
- retValue = info.getField("retval");
- return ok;
-}
-
-bool DBClientBase::eval(const string& dbname, const string& jscode) {
- BSONObj info;
- BSONElement retValue;
- return eval(dbname, jscode, info, retValue);
-}
-
list<BSONObj> DBClientBase::getCollectionInfos(const string& db, const BSONObj& filter) {
list<BSONObj> infos;
diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h
index 4b09d7bae37..141f41f880d 100644
--- a/src/mongo/client/dbclient_base.h
+++ b/src/mongo/client/dbclient_base.h
@@ -449,27 +449,6 @@ public:
const std::string& fromhost = "",
BSONObj* info = 0);
- /** Run javascript code on the database server.
- dbname database SavedContext in which the code runs. The javascript variable 'db' will be
- assigned to this database when the function is invoked.
- jscode source code for a javascript function.
- info the command object which contains any information on the invocation result
- including the return value and other information. If an error occurs running the
- jscode, error information will be in info. (try "log() << info.toString()")
- retValue return value from the jscode function.
- args args to pass to the jscode function. when invoked, the 'args' variable will be
- defined for use by the jscode.
-
- returns true if runs ok.
-
- See testDbEval() in dbclient.cpp for an example of usage.
- */
- bool eval(const std::string& dbname,
- const std::string& jscode,
- BSONObj& info,
- BSONElement& retValue,
- BSONObj* args = 0);
-
/** validate a collection, checking for errors and reporting back statistics.
this operation is slow and blocking.
*/
@@ -479,35 +458,6 @@ public:
return runCommand(nsGetDB(ns).c_str(), cmd, info);
}
- /* The following helpers are simply more convenient forms of eval() for certain common cases */
-
- /* invocation with no return value of interest -- with or without one simple parameter */
- bool eval(const std::string& dbname, const std::string& jscode);
- template <class T>
- bool eval(const std::string& dbname, const std::string& jscode, T parm1) {
- BSONObj info;
- BSONElement retValue;
- BSONObjBuilder b;
- b.append("0", parm1);
- BSONObj args = b.done();
- return eval(dbname, jscode, info, retValue, &args);
- }
-
- /** eval invocation with one parm to server and one numeric field (either int or double)
- * returned */
- template <class T, class NumType>
- bool eval(const std::string& dbname, const std::string& jscode, T parm1, NumType& ret) {
- BSONObj info;
- BSONElement retValue;
- BSONObjBuilder b;
- b.append("0", parm1);
- BSONObj args = b.done();
- if (!eval(dbname, jscode, info, retValue, &args))
- return false;
- ret = (NumType)retValue.number();
- return true;
- }
-
/**
* { name : "<short collection name>",
* options : { }
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 3d33709a590..7f16897f022 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -286,7 +286,6 @@ env.Library(
"dbhash.cpp",
"do_txn_cmd.cpp",
"driverHelpers.cpp",
- "eval.cpp",
"haystack.cpp",
"mr.cpp",
"oplog_application_checks.cpp",
diff --git a/src/mongo/db/commands/eval.cpp b/src/mongo/db/commands/eval.cpp
deleted file mode 100644
index a89f6a3780b..00000000000
--- a/src/mongo/db/commands/eval.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-// dbeval.cpp
-
-/**
-* Copyright (C) 2012 10gen Inc.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License, version 3,
-* as published by the Free Software Foundation.
-*
-* 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
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* 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 GNU Affero General 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_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/bson/util/builder.h"
-#include "mongo/db/auth/authorization_manager.h"
-#include "mongo/db/auth/authorization_manager_global.h"
-#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/client.h"
-#include "mongo/db/commands.h"
-#include "mongo/db/db_raii.h"
-#include "mongo/db/introspect.h"
-#include "mongo/db/jsobj.h"
-#include "mongo/db/json.h"
-#include "mongo/db/operation_context.h"
-#include "mongo/db/s/operation_sharding_state.h"
-#include "mongo/s/stale_exception.h"
-#include "mongo/scripting/engine.h"
-#include "mongo/util/log.h"
-#include "mongo/util/scopeguard.h"
-
-namespace mongo {
-
-using std::unique_ptr;
-using std::dec;
-using std::endl;
-using std::string;
-using std::stringstream;
-
-namespace {
-
-const int edebug = 0;
-
-bool dbEval(OperationContext* opCtx,
- const string& dbName,
- const BSONObj& cmd,
- BSONObjBuilder& result,
- string& errmsg) {
- RARELY {
- warning() << "the eval command is deprecated" << startupWarningsLog;
- }
-
- const BSONElement e = cmd.firstElement();
- uassert(
- 10046, "eval needs Code", e.type() == Code || e.type() == CodeWScope || e.type() == String);
-
- const char* code = 0;
- switch (e.type()) {
- case String:
- case Code:
- code = e.valuestr();
- break;
- case CodeWScope:
- code = e.codeWScopeCode();
- break;
- default:
- verify(0);
- }
-
- verify(code);
-
- if (!getGlobalScriptEngine()) {
- errmsg = "db side execution is disabled";
- return false;
- }
-
- unique_ptr<Scope> s(getGlobalScriptEngine()->newScope());
- s->registerOperation(opCtx);
-
- ScriptingFunction f = s->createFunction(code);
- if (f == 0) {
- errmsg = string("compile failed: ") + s->getError();
- return false;
- }
-
- s->localConnectForDbEval(opCtx, dbName.c_str());
-
- if (e.type() == CodeWScope) {
- s->init(e.codeWScopeScopeDataUnsafe());
- }
-
- BSONObj args;
- {
- BSONElement argsElement = cmd.getField("args");
- if (argsElement.type() == Array) {
- args = argsElement.embeddedObject();
- if (edebug) {
- log() << "args:" << args;
- log() << "code:\n" << redact(code);
- }
- }
- }
-
- int res;
- {
- Timer t;
- res = s->invoke(f, &args, 0, 0);
- int m = t.millis();
- if (m > serverGlobalParams.slowMS) {
- log() << "dbeval slow, time: " << dec << m << "ms " << dbName;
- if (m >= 1000)
- log() << redact(code);
- else
- OCCASIONALLY log() << redact(code);
- }
- }
-
- if (res || s->isLastRetNativeCode()) {
- result.append("errno", (double)res);
- errmsg = "invoke failed: ";
- if (s->isLastRetNativeCode())
- errmsg += "cannot return native function";
- else
- errmsg += s->getError();
-
- return false;
- }
-
- s->append(result, "retval", "__returnValue");
-
- return true;
-}
-
-
-class CmdEval : public ErrmsgCommandDeprecated {
-public:
- AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
- return AllowedOnSecondary::kNever;
- }
-
- std::string help() const override {
- return "DEPRECATED\n"
- "Evaluate javascript at the server.\n"
- "http://dochub.mongodb.org/core/serversidecodeexecution";
- }
- virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
- return false;
- }
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) const {
- RoleGraph::generateUniversalPrivileges(out);
- }
-
- CmdEval() : ErrmsgCommandDeprecated("eval", "$eval") {}
-
- bool errmsgRun(OperationContext* opCtx,
- const string& dbname,
- const BSONObj& cmdObj,
- string& errmsg,
- BSONObjBuilder& result) {
- // Note: 'eval' is not allowed to touch sharded namespaces, but we can't check the
- // shardVersions of the namespaces accessed in the script until the script is evaluated.
- // Instead, we enforce that the script does not access sharded namespaces by ensuring the
- // shardVersion is set to UNSHARDED on the OperationShardingState. The "namespace" used does
- // not matter, because if a shardVersion is set on the OperationShardingState, a check for a
- // different namespace will default to UNSHARDED.
- auto& oss = OperationShardingState::get(opCtx);
- uassert(ErrorCodes::IllegalOperation,
- "can't send a shardVersion with the 'eval' command, since you can't use sharded "
- "collections from 'eval'",
- !oss.hasShardVersion());
- oss.setGlobalUnshardedShardVersion();
-
- try {
- if (cmdObj["nolock"].trueValue()) {
- return dbEval(opCtx, dbname, cmdObj, result, errmsg);
- }
-
- Lock::GlobalWrite lk(opCtx);
-
- OldClientContext ctx(opCtx, dbname, false /* no shard version checking here */);
-
- return dbEval(opCtx, dbname, cmdObj, result, errmsg);
- } catch (const AssertionException& ex) {
- // Convert a stale shardVersion error to a stronger error to prevent this node or the
- // sending node from believing it needs to refresh its routing table.
- if (ex.code() == ErrorCodes::StaleConfig) {
- uasserted(ErrorCodes::BadValue,
- str::stream() << "can't use sharded collection from db.eval");
- }
- throw;
- }
- }
-
-} cmdeval;
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 6d74d0620ee..11a73d8b421 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -116,8 +116,6 @@ const StringMap<int> sessionCheckoutWhitelist = {{"abortTransaction", 1},
{"delete", 1},
{"distinct", 1},
{"doTxn", 1},
- {"eval", 1},
- {"$eval", 1},
{"explain", 1},
{"filemd5", 1},
{"find", 1},
diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp
index c56b915e838..224ab0b4689 100644
--- a/src/mongo/dbtests/jstests.cpp
+++ b/src/mongo/dbtests/jstests.cpp
@@ -1031,22 +1031,7 @@ public:
reset();
}
void run() {
- if (!getGlobalScriptEngine()->utf8Ok()) {
- mongo::unittest::log() << "warning: utf8 not supported" << endl;
- return;
- }
- string utf8ObjSpec = "{'_id':'\\u0001\\u007f\\u07ff\\uffff'}";
- BSONObj utf8Obj = fromjson(utf8ObjSpec);
-
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
-
- client.insert(ns(), utf8Obj);
- client.eval("unittest",
- "v = db.jstests.utf8check.findOne(); db.jstests.utf8check.remove( {} ); "
- "db.jstests.utf8check.insert( v );");
- check(utf8Obj, client.findOne(ns(), BSONObj()));
+ ASSERT(getGlobalScriptEngine()->utf8Ok());
}
private:
@@ -1071,1071 +1056,6 @@ private:
}
};
-class LongUtf8String {
-public:
- LongUtf8String() {
- reset();
- }
- ~LongUtf8String() {
- reset();
- }
- void run() {
- if (!getGlobalScriptEngine()->utf8Ok())
- return;
-
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
-
- client.eval("unittest",
- "db.jstests.longutf8string.save( {_id:'\\uffff\\uffff\\uffff\\uffff'} )");
- }
-
-private:
- void reset() {
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
-
- client.dropCollection(ns());
- }
-
- static const char* ns() {
- return "unittest.jstests.longutf8string";
- }
-};
-
-class InvalidUTF8Check {
-public:
- void run() {
- if (!getGlobalScriptEngine()->utf8Ok())
- return;
-
- unique_ptr<Scope> s;
- s.reset(getGlobalScriptEngine()->newScope());
-
- BSONObj b;
- {
- char crap[5];
-
- crap[0] = (char)128;
- crap[1] = 17;
- crap[2] = (char)128;
- crap[3] = 17;
- crap[4] = 0;
-
- BSONObjBuilder bb;
- bb.append("x", crap);
- b = bb.obj();
- }
-
- // cout << "ELIOT: " << b.jsonString() << endl;
- // its ok if this is handled by js, just can't create a c++ exception
- s->invoke("x=this.x.length;", 0, &b);
- }
-};
-
-class CodeTests {
-public:
- void run() {
- unique_ptr<Scope> s(getGlobalScriptEngine()->newScope());
-
- {
- BSONObjBuilder b;
- b.append("a", 1);
- b.appendCode("b", "function(){ out.b = 11; }");
- b.appendCodeWScope("c", "function(){ out.c = 12; }", BSONObj());
- b.appendCodeWScope("d", "function(){ out.d = 13 + bleh; }", BSON("bleh" << 5));
- s->setObject("foo", b.obj());
- }
-
- s->invokeSafe("out = {}; out.a = foo.a; foo.b(); foo.c();", 0, 0);
- BSONObj out = s->getObject("out");
-
- ASSERT_EQUALS(1, out["a"].number());
- ASSERT_EQUALS(11, out["b"].number());
- ASSERT_EQUALS(12, out["c"].number());
-
- // Guess we don't care about this
- // s->invokeSafe( "foo.d() " , BSONObj() );
- // out = s->getObject( "out" );
- // ASSERT_EQUALS( 18 , out["d"].number() );
- }
-};
-
-namespace RoundTripTests {
-
-// Inherit from this class to test round tripping of JSON objects
-class TestRoundTrip {
-public:
- virtual ~TestRoundTrip() {}
- void run() {
- {
- // Insert in Javascript -> Find using DBDirectClient
-
- // Drop the collection
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
-
- client.dropCollection("unittest.testroundtrip");
-
- // Insert in Javascript
- stringstream jsInsert;
- jsInsert << "db.testroundtrip.insert(" << jsonIn() << ")";
- ASSERT_TRUE(client.eval("unittest", jsInsert.str()));
-
- // Find using DBDirectClient
- BSONObj excludeIdProjection = BSON("_id" << 0);
- BSONObj directFind = client.findOne("unittest.testroundtrip", "", &excludeIdProjection);
- bsonEquals(bson(), directFind);
- }
-
- {
- // Insert using DBDirectClient -> Find in Javascript
-
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
-
- // Drop the collection
- client.dropCollection("unittest.testroundtrip");
-
- // Insert using DBDirectClient
- client.insert("unittest.testroundtrip", bson());
-
- // Find in Javascript
- stringstream jsFind;
- jsFind << "dbref = db.testroundtrip.findOne( { } , { _id : 0 } )\n"
- << "assert.eq(dbref, " << jsonOut() << ")";
- ASSERT_TRUE(client.eval("unittest", jsFind.str()));
- }
- }
-
-protected:
- // Methods that must be defined by child classes
- virtual BSONObj bson() const = 0;
- virtual string json() const = 0;
-
- // This can be overriden if a different meaning of equality besides woCompare is needed
- virtual void bsonEquals(const BSONObj& expected, const BSONObj& actual) {
- if (expected.woCompare(actual)) {
- ::mongo::log() << "want:" << expected.jsonString() << " size: " << expected.objsize()
- << endl;
- ::mongo::log() << "got :" << actual.jsonString() << " size: " << actual.objsize()
- << endl;
- ::mongo::log() << expected.hexDump() << endl;
- ::mongo::log() << actual.hexDump() << endl;
- }
- ASSERT(!expected.woCompare(actual));
- }
-
- // This can be overriden if the JSON representation is altered on the round trip
- virtual string jsonIn() const {
- return json();
- }
- virtual string jsonOut() const {
- return json();
- }
-};
-
-class DBRefTest : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- OID o;
- memset(&o, 0, 12);
- BSONObjBuilder subBuilder(b.subobjStart("a"));
- subBuilder.append("$ref", "ns");
- subBuilder.append("$id", o);
- subBuilder.done();
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : DBRef( \"ns\", ObjectId( \"000000000000000000000000\" ) ) }";
- }
-
- // A "fetch" function is added to the DBRef object when it is inserted using the
- // constructor, so we need to compare the fields individually
- virtual void bsonEquals(const BSONObj& expected, const BSONObj& actual) {
- ASSERT_EQUALS(expected["a"].type(), actual["a"].type());
- ASSERT_EQUALS(expected["a"]["$id"].OID(), actual["a"]["$id"].OID());
- ASSERT_EQUALS(expected["a"]["$ref"].String(), actual["a"]["$ref"].String());
- }
-};
-
-class DBPointerTest : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- OID o;
- memset(&o, 0, 12);
- b.appendDBRef("a", "ns", o);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : DBPointer( \"ns\", ObjectId( \"000000000000000000000000\" ) ) }";
- }
-};
-
-class InformalDBRefTest : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- BSONObjBuilder subBuilder(b.subobjStart("a"));
- subBuilder.append("$ref", "ns");
- subBuilder.append("$id", "000000000000000000000000");
- subBuilder.done();
- return b.obj();
- }
-
- // Don't need to return anything because we are overriding both jsonOut and jsonIn
- virtual string json() const {
- return "";
- }
-
- // Need to override these because the JSON doesn't actually round trip.
- // An object with "$ref" and "$id" fields is handled specially and different on the way out.
- virtual string jsonOut() const {
- return "{ \"a\" : DBRef( \"ns\", \"000000000000000000000000\" ) }";
- }
- virtual string jsonIn() const {
- stringstream ss;
- ss << "{ \"a\" : { \"$ref\" : \"ns\" , "
- << "\"$id\" : \"000000000000000000000000\" } }";
- return ss.str();
- }
-};
-
-class InformalDBRefOIDTest : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- OID o;
- memset(&o, 0, 12);
- BSONObjBuilder subBuilder(b.subobjStart("a"));
- subBuilder.append("$ref", "ns");
- subBuilder.append("$id", o);
- subBuilder.done();
- return b.obj();
- }
-
- // Don't need to return anything because we are overriding both jsonOut and jsonIn
- virtual string json() const {
- return "";
- }
-
- // Need to override these because the JSON doesn't actually round trip.
- // An object with "$ref" and "$id" fields is handled specially and different on the way out.
- virtual string jsonOut() const {
- return "{ \"a\" : DBRef( \"ns\", ObjectId( \"000000000000000000000000\" ) ) }";
- }
- virtual string jsonIn() const {
- stringstream ss;
- ss << "{ \"a\" : { \"$ref\" : \"ns\" , "
- << "\"$id\" : ObjectId( \"000000000000000000000000\" ) } }";
- return ss.str();
- }
-};
-
-class InformalDBRefExtraFieldTest : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- OID o;
- memset(&o, 0, 12);
- BSONObjBuilder subBuilder(b.subobjStart("a"));
- subBuilder.append("$ref", "ns");
- subBuilder.append("$id", o);
- subBuilder.append("otherfield", "value");
- subBuilder.done();
- return b.obj();
- }
-
- // Don't need to return anything because we are overriding both jsonOut and jsonIn
- virtual string json() const {
- return "";
- }
-
- // Need to override these because the JSON doesn't actually round trip.
- // An object with "$ref" and "$id" fields is handled specially and different on the way out.
- virtual string jsonOut() const {
- return "{ \"a\" : DBRef( \"ns\", ObjectId( \"000000000000000000000000\" ) ) }";
- }
- virtual string jsonIn() const {
- stringstream ss;
- ss << "{ \"a\" : { \"$ref\" : \"ns\" , "
- << "\"$id\" : ObjectId( \"000000000000000000000000\" ) , "
- << "\"otherfield\" : \"value\" } }";
- return ss.str();
- }
-};
-
-class Empty : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- return b.obj();
- }
- virtual string json() const {
- return "{}";
- }
-};
-
-class EmptyWithSpace : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- return b.obj();
- }
- virtual string json() const {
- return "{ }";
- }
-};
-
-class SingleString : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", "b");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : \"b\" }";
- }
-};
-
-class EmptyStrings : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("", "");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"\" : \"\" }";
- }
-};
-
-class SingleNumber : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", 1);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : 1 }";
- }
-};
-
-class RealNumber : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- double d;
- ASSERT_OK(parseNumberFromString("0.7", &d));
- b.append("a", d);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : 0.7 }";
- }
-};
-
-class FancyNumber : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- double d;
- ASSERT_OK(parseNumberFromString("-4.4433e-2", &d));
- b.append("a", d);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : -4.4433e-2 }";
- }
-};
-
-class TwoElements : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", 1);
- b.append("b", "foo");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : 1, \"b\" : \"foo\" }";
- }
-};
-
-class Subobject : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", 1);
- BSONObjBuilder c;
- c.append("z", b.done());
- return c.obj();
- }
- virtual string json() const {
- return "{ \"z\" : { \"a\" : 1 } }";
- }
-};
-
-class DeeplyNestedObject : public TestRoundTrip {
- virtual string buildJson(int depth) const {
- if (depth == 0) {
- return "{\"0\":true}";
- } else {
- std::stringstream ss;
- ss << "{\"" << depth << "\":" << buildJson(depth - 1) << "}";
- depth--;
- return ss.str();
- }
- }
- virtual BSONObj buildBson(int depth) const {
- BSONObjBuilder builder;
- if (depth == 0) {
- builder.append("0", true);
- return builder.obj();
- } else {
- std::stringstream ss;
- ss << depth;
- depth--;
- builder.append(ss.str(), buildBson(depth));
- return builder.obj();
- }
- }
- virtual BSONObj bson() const {
- return buildBson(35);
- }
- virtual string json() const {
- return buildJson(35);
- }
-};
-
-class ArrayEmpty : public TestRoundTrip {
- virtual BSONObj bson() const {
- vector<int> arr;
- BSONObjBuilder b;
- b.append("a", arr);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : [] }";
- }
-};
-
-class Array : public TestRoundTrip {
- virtual BSONObj bson() const {
- vector<int> arr;
- arr.push_back(1);
- arr.push_back(2);
- arr.push_back(3);
- BSONObjBuilder b;
- b.append("a", arr);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : [ 1, 2, 3 ] }";
- }
-};
-
-class True : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendBool("a", true);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : true }";
- }
-};
-
-class False : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendBool("a", false);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : false }";
- }
-};
-
-class Null : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendNull("a");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : null }";
- }
-};
-
-class Undefined : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendUndefined("a");
- return b.obj();
- }
-
- virtual string json() const {
- return "{ \"a\" : undefined }";
- }
-};
-
-class EscapedCharacters : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", "\" \\ / \b \f \n \r \t \v");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : \"\\\" \\\\ \\/ \\b \\f \\n \\r \\t \\v\" }";
- }
-};
-
-class NonEscapedCharacters : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", "% { a z $ # ' ");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : \"\\% \\{ \\a \\z \\$ \\# \\' \\ \" }";
- }
-};
-
-class AllowedControlCharacter : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", "\x7f");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : \"\x7f\" }";
- }
-};
-
-class NumbersInFieldName : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("b1", "b");
- return b.obj();
- }
- virtual string json() const {
- return "{ b1 : \"b\" }";
- }
-};
-
-class EscapeFieldName : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("\n", "b");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"\\n\" : \"b\" }";
- }
-};
-
-class EscapedUnicodeToUtf8 : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- unsigned char u[7];
- u[0] = 0xe0 | 0x0a;
- u[1] = 0x80;
- u[2] = 0x80;
- u[3] = 0xe0 | 0x0a;
- u[4] = 0x80;
- u[5] = 0x80;
- u[6] = 0;
- b.append("a", (char*)u);
- BSONObj built = b.obj();
- ASSERT_EQUALS(string((char*)u), built.firstElement().valuestr());
- return built;
- }
- virtual string json() const {
- return "{ \"a\" : \"\\ua000\\uA000\" }";
- }
-};
-
-class Utf8AllOnes : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- unsigned char u[8];
- u[0] = 0x01;
-
- u[1] = 0x7f;
-
- u[2] = 0xdf;
- u[3] = 0xbf;
-
- u[4] = 0xef;
- u[5] = 0xbf;
- u[6] = 0xbf;
-
- u[7] = 0;
-
- b.append("a", (char*)u);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : \"\\u0001\\u007f\\u07ff\\uffff\" }";
- }
-};
-
-class Utf8FirstByteOnes : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- unsigned char u[6];
- u[0] = 0xdc;
- u[1] = 0x80;
-
- u[2] = 0xef;
- u[3] = 0xbc;
- u[4] = 0x80;
-
- u[5] = 0;
-
- b.append("a", (char*)u);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : \"\\u0700\\uff00\" }";
- }
-};
-
-class BinData : public TestRoundTrip {
- virtual BSONObj bson() const {
- char z[3];
- z[0] = 'a';
- z[1] = 'b';
- z[2] = 'c';
- BSONObjBuilder b;
- b.appendBinData("a", 3, BinDataGeneral, z);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : BinData( 0 , \"YWJj\" ) }";
- }
-};
-
-class BinDataPaddedSingle : public TestRoundTrip {
- virtual BSONObj bson() const {
- char z[2];
- z[0] = 'a';
- z[1] = 'b';
- BSONObjBuilder b;
- b.appendBinData("a", 2, BinDataGeneral, z);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : BinData( 0 , \"YWI=\" ) }";
- }
-};
-
-class BinDataPaddedDouble : public TestRoundTrip {
- virtual BSONObj bson() const {
- char z[1];
- z[0] = 'a';
- BSONObjBuilder b;
- b.appendBinData("a", 1, BinDataGeneral, z);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : BinData( 0 , \"YQ==\" ) }";
- }
-};
-
-class BinDataAllChars : public TestRoundTrip {
- virtual BSONObj bson() const {
- unsigned char z[] = {0x00, 0x10, 0x83, 0x10, 0x51, 0x87, 0x20, 0x92, 0x8B, 0x30,
- 0xD3, 0x8F, 0x41, 0x14, 0x93, 0x51, 0x55, 0x97, 0x61, 0x96,
- 0x9B, 0x71, 0xD7, 0x9F, 0x82, 0x18, 0xA3, 0x92, 0x59, 0xA7,
- 0xA2, 0x9A, 0xAB, 0xB2, 0xDB, 0xAF, 0xC3, 0x1C, 0xB3, 0xD3,
- 0x5D, 0xB7, 0xE3, 0x9E, 0xBB, 0xF3, 0xDF, 0xBF};
- BSONObjBuilder b;
- b.appendBinData("a", 48, BinDataGeneral, z);
- return b.obj();
- }
- virtual string json() const {
- stringstream ss;
- ss << "{ \"a\" : BinData( 0 , \"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- << "abcdefghijklmnopqrstuvwxyz0123456789+/\" ) }";
- return ss.str();
- }
-};
-
-class Date : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendDate("a", Date_t());
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : new Date( 0 ) }";
- }
-};
-
-class DateNonzero : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendDate("a", Date_t::fromMillisSinceEpoch(100));
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : new Date( 100 ) }";
- }
-};
-
-class DateNegative : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendDate("a", Date_t::fromMillisSinceEpoch(-1));
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : new Date( -1 ) }";
- }
-};
-
-class JSTimestamp : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a", Timestamp(20, 5));
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : Timestamp( 20, 5 ) }";
- }
-};
-
-class TimestampMax : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendMaxForType("a", mongo::bsonTimestamp);
- BSONObj o = b.obj();
- return o;
- }
- virtual string json() const {
- Timestamp opTime = Timestamp::max();
- stringstream ss;
- ss << "{ \"a\" : Timestamp( " << opTime.getSecs() << ", " << opTime.getInc() << " ) }";
- return ss.str();
- }
-};
-
-class Regex : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendRegex("a", "b", "");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : /b/ }";
- }
-};
-
-class RegexWithQuotes : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.appendRegex("a", "\"", "");
- return b.obj();
- }
- virtual string json() const {
- return "{ \"a\" : /\"/ }";
- }
-};
-
-class UnquotedFieldName : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("a_b", 1);
- return b.obj();
- }
- virtual string json() const {
- return "{ a_b : 1 }";
- }
-};
-
-class SingleQuotes : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("ab'c\"", "bb\b '\"");
- return b.obj();
- }
- virtual string json() const {
- return "{ 'ab\\'c\"' : 'bb\\b \\'\"' }";
- }
-};
-
-class ObjectId : public TestRoundTrip {
- virtual BSONObj bson() const {
- OID id;
- id.init("deadbeeff00ddeadbeeff00d");
- BSONObjBuilder b;
- b.appendOID("foo", &id);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"foo\": ObjectId( \"deadbeeff00ddeadbeeff00d\" ) }";
- }
-};
-
-class NumberLong : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("long" << 4611686018427387904ll); // 2**62
- }
- virtual string json() const {
- return "{ \"long\": NumberLong(4611686018427387904) }";
- }
-};
-
-class NumberInt : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("int" << static_cast<int>(100));
- }
- virtual string json() const {
- return "{ \"int\": NumberInt(100) }";
- }
-};
-
-class Number : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("double" << 3.14);
- }
- virtual string json() const {
- return "{ \"double\": Number(3.14) }";
- }
-};
-
-class NumberDecimal : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("2.010"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"+2.010\") }";
- }
-};
-
-class NumberDecimalNegative : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("-4.018"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"-4018E-3\") }";
- }
-};
-
-class NumberDecimalMax : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("+9.999999999999999999999999999999999E6144"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"+9999999999999999999999999999999999E6111\") }";
- }
-};
-
-class NumberDecimalMin : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("0.000000000000000000000000000000001E-6143"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"+1E-6176\") }";
- }
-};
-
-class NumberDecimalPositiveZero : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("0"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"0\") }";
- }
-};
-
-class NumberDecimalNegativeZero : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("-0"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"-0\") }";
- }
-};
-
-class NumberDecimalPositiveNaN : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("NaN"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"NaN\") }";
- }
-};
-
-class NumberDecimalNegativeNaN : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("-NaN"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"-NaN\") }";
- }
-};
-
-class NumberDecimalPositiveInfinity : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("1E999999"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"+Inf\") }";
- }
-};
-
-class NumberDecimalNegativeInfinity : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("-1E999999"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"-Inf\") }";
- }
-};
-
-class NumberDecimalPrecision : public TestRoundTrip {
-public:
- virtual BSONObj bson() const {
- return BSON("decimal" << Decimal128("5.00"));
- }
- virtual string json() const {
- return "{ \"decimal\": NumberDecimal(\"+500E-2\") }";
- }
-};
-
-class UUID : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- unsigned char z[] = {0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0x00,
- 0x00,
- 0x00,
- 0x00};
- b.appendBinData("a", 16, bdtUUID, z);
- return b.obj();
- }
-
- // Don't need to return anything because we are overriding both jsonOut and jsonIn
- virtual string json() const {
- return "";
- }
-
- // The UUID constructor corresponds to a special BinData type
- virtual string jsonIn() const {
- return "{ \"a\" : UUID(\"abcdefabcdefabcdefabcdef00000000\") }";
- }
- virtual string jsonOut() const {
- return "{ \"a\" : BinData(3,\"q83vq83vq83vq83vAAAAAA==\") }";
- }
-};
-
-class HexData : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- unsigned char z[] = {0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0x00,
- 0x00,
- 0x00,
- 0x00};
- b.appendBinData("a", 16, BinDataGeneral, z);
- return b.obj();
- }
-
- // Don't need to return anything because we are overriding both jsonOut and jsonIn
- virtual string json() const {
- return "";
- }
-
- // The HexData constructor creates a BinData type from a hex string
- virtual string jsonIn() const {
- return "{ \"a\" : HexData(0,\"abcdefabcdefabcdefabcdef00000000\") }";
- }
- virtual string jsonOut() const {
- return "{ \"a\" : BinData(0,\"q83vq83vq83vq83vAAAAAA==\") }";
- }
-};
-
-class MD5 : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- unsigned char z[] = {0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0xAB,
- 0xCD,
- 0xEF,
- 0x00,
- 0x00,
- 0x00,
- 0x00};
- b.appendBinData("a", 16, MD5Type, z);
- return b.obj();
- }
-
- // Don't need to return anything because we are overriding both jsonOut and jsonIn
- virtual string json() const {
- return "";
- }
-
- // The HexData constructor creates a BinData type from a hex string
- virtual string jsonIn() const {
- return "{ \"a\" : MD5(\"abcdefabcdefabcdefabcdef00000000\") }";
- }
- virtual string jsonOut() const {
- return "{ \"a\" : BinData(5,\"q83vq83vq83vq83vAAAAAA==\") }";
- }
-};
-
-class NullString : public TestRoundTrip {
- virtual BSONObj bson() const {
- BSONObjBuilder b;
- b.append("x", "a\0b", 4);
- return b.obj();
- }
- virtual string json() const {
- return "{ \"x\" : \"a\\u0000b\" }";
- }
-};
-
-} // namespace RoundTripTests
class BinDataType {
public:
@@ -2277,44 +1197,6 @@ public:
}
};
-
-class InvalidStoredJS {
-public:
- void run() {
- BSONObjBuilder query;
- query.append("_id", "invalidstoredjs1");
-
- BSONObjBuilder update;
- update.append("_id", "invalidstoredjs1");
- update.appendCode("value",
- "function () { db.test.find().forEach(function(obj) { continue; }); }");
- {
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
- client.update("test.system.js", query.obj(), update.obj(), true /* upsert */);
- }
-
- unique_ptr<Scope> s(getGlobalScriptEngine()->newScope());
- {
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
- client.eval("test", "invalidstoredjs1()");
- }
-
- BSONObj info;
- BSONElement ret;
- {
- const ServiceContext::UniqueOperationContext opCtxPtr = cc().makeOperationContext();
- OperationContext& opCtx = *opCtxPtr;
- DBDirectClient client(&opCtx);
- ASSERT(client.eval("test", "return 5 + 12", info, ret));
- }
- ASSERT_EQUALS(17, ret.number());
- }
-};
-
/**
* This tests a bug discovered in SERVER-24054, where certain interesting nan patterns crash
* spidermonkey by looking like non-double type puns. This verifies that we put that particular
@@ -2619,22 +1501,13 @@ public:
add<RenameTest>();
add<WeirdObjects>();
- add<CodeTests>();
add<BinDataType>();
add<VarTests>();
-
add<Speed1>();
-
- add<InvalidUTF8Check>();
add<Utf8Check>();
- add<LongUtf8String>();
-
add<ScopeOut>();
- add<InvalidStoredJS>();
-
add<NovelNaN>();
-
add<NoReturnSpecified>();
add<RecursiveInvoke>();
@@ -2642,70 +1515,6 @@ public:
add<ErrorWithSidecarFromInvoke>();
add<RequiresOwnedObjects>();
add<ConvertShardKeyToHashed>();
-
- add<RoundTripTests::DBRefTest>();
- add<RoundTripTests::DBPointerTest>();
- add<RoundTripTests::InformalDBRefTest>();
- add<RoundTripTests::InformalDBRefOIDTest>();
- add<RoundTripTests::InformalDBRefExtraFieldTest>();
- add<RoundTripTests::Empty>();
- add<RoundTripTests::EmptyWithSpace>();
- add<RoundTripTests::SingleString>();
- add<RoundTripTests::EmptyStrings>();
- add<RoundTripTests::SingleNumber>();
- add<RoundTripTests::RealNumber>();
- add<RoundTripTests::FancyNumber>();
- add<RoundTripTests::TwoElements>();
- add<RoundTripTests::Subobject>();
- add<RoundTripTests::DeeplyNestedObject>();
- add<RoundTripTests::ArrayEmpty>();
- add<RoundTripTests::Array>();
- add<RoundTripTests::True>();
- add<RoundTripTests::False>();
- add<RoundTripTests::Null>();
- add<RoundTripTests::Undefined>();
- add<RoundTripTests::EscapedCharacters>();
- add<RoundTripTests::NonEscapedCharacters>();
- add<RoundTripTests::AllowedControlCharacter>();
- add<RoundTripTests::NumbersInFieldName>();
- add<RoundTripTests::EscapeFieldName>();
- add<RoundTripTests::EscapedUnicodeToUtf8>();
- add<RoundTripTests::Utf8AllOnes>();
- add<RoundTripTests::Utf8FirstByteOnes>();
- add<RoundTripTests::BinData>();
- add<RoundTripTests::BinDataPaddedSingle>();
- add<RoundTripTests::BinDataPaddedDouble>();
- add<RoundTripTests::BinDataAllChars>();
- add<RoundTripTests::Date>();
- add<RoundTripTests::DateNonzero>();
- add<RoundTripTests::DateNegative>();
- add<RoundTripTests::JSTimestamp>();
- add<RoundTripTests::TimestampMax>();
- add<RoundTripTests::Regex>();
- add<RoundTripTests::RegexWithQuotes>();
- add<RoundTripTests::UnquotedFieldName>();
- add<RoundTripTests::SingleQuotes>();
- add<RoundTripTests::ObjectId>();
- add<RoundTripTests::NumberLong>();
- add<RoundTripTests::NumberInt>();
- add<RoundTripTests::Number>();
-
- add<RoundTripTests::NumberDecimal>();
- add<RoundTripTests::NumberDecimalNegative>();
- add<RoundTripTests::NumberDecimalMax>();
- add<RoundTripTests::NumberDecimalMin>();
- add<RoundTripTests::NumberDecimalPositiveZero>();
- add<RoundTripTests::NumberDecimalNegativeZero>();
- add<RoundTripTests::NumberDecimalPositiveNaN>();
- add<RoundTripTests::NumberDecimalNegativeNaN>();
- add<RoundTripTests::NumberDecimalPositiveInfinity>();
- add<RoundTripTests::NumberDecimalNegativeInfinity>();
- add<RoundTripTests::NumberDecimalPrecision>();
-
- add<RoundTripTests::UUID>();
- add<RoundTripTests::HexData>();
- add<RoundTripTests::MD5>();
- add<RoundTripTests::NullString>();
}
};
diff --git a/src/mongo/s/commands/SConscript b/src/mongo/s/commands/SConscript
index 9fd5bb05d18..270624a33ea 100644
--- a/src/mongo/s/commands/SConscript
+++ b/src/mongo/s/commands/SConscript
@@ -44,7 +44,6 @@ env.Library(
'cluster_drop_database_cmd.cpp',
'cluster_drop_indexes_cmd.cpp',
'cluster_enable_sharding_cmd.cpp',
- 'cluster_eval_cmd.cpp',
'cluster_explain.cpp',
'cluster_explain_cmd.cpp',
'cluster_filemd5_cmd.cpp',
diff --git a/src/mongo/s/commands/cluster_eval_cmd.cpp b/src/mongo/s/commands/cluster_eval_cmd.cpp
deleted file mode 100644
index b546a4f7dc4..00000000000
--- a/src/mongo/s/commands/cluster_eval_cmd.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Copyright (C) 2015 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * 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 GNU Affero General 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_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/auth/role_graph.h"
-#include "mongo/db/commands.h"
-#include "mongo/s/catalog_cache.h"
-#include "mongo/s/grid.h"
-#include "mongo/util/log.h"
-
-namespace mongo {
-namespace {
-
-class EvalCmd : public BasicCommand {
-public:
- EvalCmd() : BasicCommand("eval", "$eval") {}
-
- AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
- return AllowedOnSecondary::kAlways;
- }
-
- void addRequiredPrivileges(const std::string& dbName,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) const override {
- // $eval can do pretty much anything, so require all privileges.
- RoleGraph::generateUniversalPrivileges(out);
- }
-
- bool supportsWriteConcern(const BSONObj& cmd) const override {
- return false;
- }
-
- bool run(OperationContext* opCtx,
- const std::string& dbName,
- const BSONObj& cmdObj,
- BSONObjBuilder& result) override {
- RARELY {
- warning() << "the eval command is deprecated" << startupWarningsLog;
- }
-
- // $eval isn't allowed to access sharded collections, but we need to leave the shard to
- // detect that
- const auto dbInfo =
- uassertStatusOK(Grid::get(opCtx)->catalogCache()->getDatabase(opCtx, dbName));
- auto shard =
- uassertStatusOK(Grid::get(opCtx)->shardRegistry()->getShard(opCtx, dbInfo.primaryId()));
-
- auto commandResponse = uassertStatusOK(
- shard->runCommand(opCtx,
- ReadPreferenceSetting::get(opCtx),
- dbName,
- CommandHelpers::filterCommandRequestForPassthrough(cmdObj),
- Shard::RetryPolicy::kNoRetry));
-
- result.appendElementsUnique(
- CommandHelpers::filterCommandReplyForPassthrough(commandResponse.response));
- return true;
- }
-
-} evalCmd;
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index cd5e5bcd767..57a5d98f1e6 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -419,9 +419,6 @@ public:
void init(const BSONObj* data) {
_real->init(data);
}
- void localConnectForDbEval(OperationContext* opCtx, const char* dbName) {
- invariant(!"localConnectForDbEval should only be called from dbEval");
- }
void setLocalDB(const string& dbName) {
_real->setLocalDB(dbName);
}
diff --git a/src/mongo/scripting/engine.h b/src/mongo/scripting/engine.h
index 2ed64157e01..34b3351f08b 100644
--- a/src/mongo/scripting/engine.h
+++ b/src/mongo/scripting/engine.h
@@ -63,7 +63,6 @@ public:
init(&o);
}
- virtual void localConnectForDbEval(OperationContext* opCtx, const char* dbName) = 0;
virtual void externalSetup() = 0;
virtual void setLocalDB(const std::string& localDBName) {
_localDBName = localDBName;
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp
index f7f6577fe23..660bc7f59b9 100644
--- a/src/mongo/scripting/mozjs/implscope.cpp
+++ b/src/mongo/scripting/mozjs/implscope.cpp
@@ -449,7 +449,6 @@ MozJSImplScope::MozJSImplScope(MozJSScriptEngine* engine)
_minKeyProto(_context),
_mongoExternalProto(_context),
_mongoHelpersProto(_context),
- _mongoLocalProto(_context),
_nativeFunctionProto(_context),
_numberDecimalProto(_context),
_numberIntProto(_context),
@@ -816,48 +815,11 @@ void MozJSImplScope::sleep(Milliseconds ms) {
lk, ms.toSystemDuration(), [this] { return !_killStatus.isOK(); }));
}
-void MozJSImplScope::localConnectForDbEval(OperationContext* opCtx, const char* dbName) {
-
- _runSafely([this, &opCtx, &dbName] {
- if (_connectState == ConnectState::External)
- uasserted(12510, "externalSetup already called, can't call localConnect");
- if (_connectState == ConnectState::Local) {
- if (_localDBName == dbName)
- return;
- uasserted(12511,
- str::stream() << "localConnect previously called with name " << _localDBName);
- }
-
- // NOTE: order is important here. the following methods must be called after
- // the above conditional statements.
-
- _connectState = ConnectState::Local;
- _localDBName = dbName;
-
- loadStored(opCtx);
-
- // install db access functions in the global object
- installDBAccess();
-
- // install the Mongo function object and instantiate the 'db' global
- _mongoLocalProto.install(_global);
- execCoreFiles();
-
- const char* const makeMongo = "const _mongo = new Mongo()";
- exec(makeMongo, "local connect 2", false, true, true, 0);
-
- std::string makeDB = str::stream() << "const db = _mongo.getDB(\"" << dbName << "\");";
- exec(makeDB, "local connect 3", false, true, true, 0);
- });
-}
-
void MozJSImplScope::externalSetup() {
_runSafely([&] {
if (_connectState == ConnectState::External)
return;
- if (_connectState == ConnectState::Local)
- uasserted(12512, "localConnect already called, can't call externalSetup");
// install db access functions in the global object
installDBAccess();
diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h
index 72fe9db3f72..930dae82a2e 100644
--- a/src/mongo/scripting/mozjs/implscope.h
+++ b/src/mongo/scripting/mozjs/implscope.h
@@ -103,8 +103,6 @@ public:
void unregisterOperation() override;
- void localConnectForDbEval(OperationContext* opCtx, const char* dbName) override;
-
void externalSetup() override;
std::string getError() override;
@@ -245,11 +243,6 @@ public:
}
template <typename T>
- typename std::enable_if<std::is_same<T, MongoLocalInfo>::value, WrapType<T>&>::type getProto() {
- return _mongoLocalProto;
- }
-
- template <typename T>
typename std::enable_if<std::is_same<T, NativeFunctionInfo>::value, WrapType<T>&>::type
getProto() {
return _nativeFunctionProto;
@@ -389,12 +382,9 @@ private:
/**
* The connection state of the scope.
- *
- * This is for dbeval and the shell
*/
enum class ConnectState : char {
Not,
- Local,
External,
};
@@ -453,7 +443,6 @@ private:
WrapType<MinKeyInfo> _minKeyProto;
WrapType<MongoExternalInfo> _mongoExternalProto;
WrapType<MongoHelpersInfo> _mongoHelpersProto;
- WrapType<MongoLocalInfo> _mongoLocalProto;
WrapType<NativeFunctionInfo> _nativeFunctionProto;
WrapType<NumberDecimalInfo> _numberDecimalProto;
WrapType<NumberIntInfo> _numberIntProto;
diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp
index aa08c2a4ad8..22a6a728461 100644
--- a/src/mongo/scripting/mozjs/mongo.cpp
+++ b/src/mongo/scripting/mozjs/mongo.cpp
@@ -62,36 +62,26 @@ namespace mozjs {
const JSFunctionSpec MongoBase::methods[] = {
MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(auth, MongoExternalInfo),
MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(close, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- copyDatabaseWithSCRAM, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(cursorFromId, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- cursorHandleFromId, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(find, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- getClientRPCProtocols, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- getServerRPCProtocols, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(insert, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- isReplicaSetConnection, MongoLocalInfo, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(copyDatabaseWithSCRAM, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(cursorFromId, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(cursorHandleFromId, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(find, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(getClientRPCProtocols, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(getServerRPCProtocols, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(insert, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(isReplicaSetConnection, MongoExternalInfo),
MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(_markNodeAsFailed, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(logout, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(remove, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(runCommand, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- runCommandWithMetadata, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- setClientRPCProtocols, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(update, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- getMinWireVersion, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- getMaxWireVersion, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(
- isReplicaSetMember, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(isMongos, MongoLocalInfo, MongoExternalInfo),
- MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(_startSession, MongoLocalInfo, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(logout, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(remove, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(runCommand, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(runCommandWithMetadata, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(setClientRPCProtocols, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(update, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(getMinWireVersion, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(getMaxWireVersion, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(isReplicaSetMember, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(isMongos, MongoExternalInfo),
+ MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(_startSession, MongoExternalInfo),
JS_FS_END,
};
@@ -156,12 +146,7 @@ void setHiddenMongo(JSContext* cx,
JS::RootedObject newMongo(cx);
auto scope = getScope(cx);
- auto isLocalInfo = scope->getProto<MongoLocalInfo>().instanceOf(args.thisv());
- if (isLocalInfo) {
- scope->getProto<MongoLocalInfo>().newObject(&newMongo);
- } else {
- scope->getProto<MongoExternalInfo>().newObject(&newMongo);
- }
+ scope->getProto<MongoExternalInfo>().newObject(&newMongo);
auto host = resPtr->getServerAddress();
JS_SetPrivate(newMongo,
@@ -715,27 +700,6 @@ void MongoBase::Functions::_markNodeAsFailed::call(JSContext* cx, JS::CallArgs a
args.rval().setUndefined();
}
-void MongoLocalInfo::construct(JSContext* cx, JS::CallArgs args) {
- auto scope = getScope(cx);
-
- if (args.length() != 0)
- uasserted(ErrorCodes::BadValue, "local Mongo constructor takes no args");
-
- auto opCtx = scope->getOpContext();
- auto conn = DBDirectClientFactory::get(opCtx).create(opCtx);
-
- JS::RootedObject thisv(cx);
- scope->getProto<MongoLocalInfo>().newObject(&thisv);
- ObjectWrapper o(cx, thisv);
-
- JS_SetPrivate(thisv, scope->trackedNew<std::shared_ptr<DBClientBase>>(conn.release()));
-
- o.setBoolean(InternedString::slaveOk, false);
- o.setString(InternedString::host, "EMBEDDED");
-
- args.rval().setObjectOrNull(thisv);
-}
-
void MongoExternalInfo::construct(JSContext* cx, JS::CallArgs args) {
auto scope = getScope(cx);
diff --git a/src/mongo/scripting/mozjs/mongo.h b/src/mongo/scripting/mozjs/mongo.h
index 36fbc46a172..2329cc82f1e 100644
--- a/src/mongo/scripting/mozjs/mongo.h
+++ b/src/mongo/scripting/mozjs/mongo.h
@@ -75,13 +75,6 @@ struct MongoBase : public BaseInfo {
};
/**
- * The dbeval variant of "Mongo"
- */
-struct MongoLocalInfo : public MongoBase {
- static void construct(JSContext* cx, JS::CallArgs args);
-};
-
-/**
* The shell variant of "Mongo"
*/
struct MongoExternalInfo : public MongoBase {
diff --git a/src/mongo/scripting/mozjs/proxyscope.cpp b/src/mongo/scripting/mozjs/proxyscope.cpp
index 60e979bac74..4ed77bf7938 100644
--- a/src/mongo/scripting/mozjs/proxyscope.cpp
+++ b/src/mongo/scripting/mozjs/proxyscope.cpp
@@ -95,10 +95,6 @@ void MozJSProxyScope::unregisterOperation() {
run([&] { _implScope->unregisterOperation(); });
}
-void MozJSProxyScope::localConnectForDbEval(OperationContext* opCtx, const char* dbName) {
- run([&] { _implScope->localConnectForDbEval(opCtx, dbName); });
-}
-
void MozJSProxyScope::externalSetup() {
run([&] { _implScope->externalSetup(); });
}
diff --git a/src/mongo/scripting/mozjs/proxyscope.h b/src/mongo/scripting/mozjs/proxyscope.h
index 0b936de20ed..56b792a8583 100644
--- a/src/mongo/scripting/mozjs/proxyscope.h
+++ b/src/mongo/scripting/mozjs/proxyscope.h
@@ -122,8 +122,6 @@ public:
void unregisterOperation() override;
- void localConnectForDbEval(OperationContext* opCtx, const char* dbName) override;
-
void externalSetup() override;
std::string getError() override;