diff options
author | Naama Bareket <naama.bareket@mongodb.com> | 2023-04-10 14:11:38 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-04-10 15:24:43 +0000 |
commit | 6c2987acbfe5bf785a2476283f0ae84ea7fc334f (patch) | |
tree | 28ae0611ee26dab60d389e4f8c607e968afe5682 | |
parent | 65470b718d3aa183ede71411dc4f2b0fe24a97e3 (diff) | |
download | mongo-6c2987acbfe5bf785a2476283f0ae84ea7fc334f.tar.gz |
SERVER-74166: Mark 'temp' field in create command as stable to support $out flow
-rw-r--r-- | buildscripts/idl/idl_check_compatibility.py | 1 | ||||
-rw-r--r-- | buildscripts/resmokeconfig/suites/sharding_api_strict_passthrough.yml | 14 | ||||
-rw-r--r-- | jstests/sharding/query/out_with_api_strict.js | 37 | ||||
-rw-r--r-- | src/mongo/db/commands/create.idl | 7 |
4 files changed, 43 insertions, 16 deletions
diff --git a/buildscripts/idl/idl_check_compatibility.py b/buildscripts/idl/idl_check_compatibility.py index 791a6186b0b..2b40867519f 100644 --- a/buildscripts/idl/idl_check_compatibility.py +++ b/buildscripts/idl/idl_check_compatibility.py @@ -311,6 +311,7 @@ ALLOWED_STABLE_FIELDS_LIST: List[str] = [ 'listIndexes-reply-clustered', 'create-param-encryptedFields', 'create-param-bucketRoundingSeconds', + 'create-param-temp', 'endSessions-param-txnNumber', 'endSessions-param-txnUUID', 'refreshSessions-param-txnNumber', diff --git a/buildscripts/resmokeconfig/suites/sharding_api_strict_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_api_strict_passthrough.yml index b934d8dfc89..ca81b50ad6c 100644 --- a/buildscripts/resmokeconfig/suites/sharding_api_strict_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/sharding_api_strict_passthrough.yml @@ -10,30 +10,16 @@ selector: - jstests/sharding/auth_sharding_cmd_metadata.js - jstests/sharding/change_stream_update_lookup_collation.js - jstests/sharding/count_config_servers.js - # TODO SERVER-75496: Uncomment once ticket is complete. - # - jstests/sharding/hash_crud.js - jstests/sharding/internal_txns/end_sessions.js - jstests/sharding/internal_txns/retry_on_transient_error_basic.js - jstests/sharding/internal_txns/retry_on_transient_error_validation.js - jstests/sharding/logical_time_api.js - jstests/sharding/max_time_ms_enforced_on_shard.js - jstests/sharding/mongod_returns_no_cluster_time_without_keys.js - # TODO SERVER-74161: Uncomment once ticket is complete. - # - jstests/sharding/query/agg_js_on_mongos.js - # TODO SERVER-74176: Uncomment once ticket is complete. - # - jstests/sharding/query/collation_lookup.js - jstests/sharding/query/collation_shard_targeting_hashed_shard_key.js - # TODO SERVER-75496: Uncomment once ticket is complete. - # - jstests/sharding/query/current_op_with_drop_shard.js - # TODO SERVER-74167: Uncomment once ticket is complete. - # - jstests/sharding/query/explain_cmd.js - jstests/sharding/query/mongos_query_comment.js - # TODO SERVER-74166: Uncomment once ticket is complete. - # - jstests/sharding/query/merge_to_non_existing.js - jstests/sharding/query/pipeline_length_limit.js - jstests/sharding/query/pipeline_pass_through_from_mongos.js - # TODO SERVER-75496: Uncomment once ticket is complete. - # - jstests/sharding/query/union_sharded_views.js - jstests/sharding/query/view_on_shard_rewrite.js - jstests/sharding/resharding_prohibited_commands.js - jstests/sharding/resharding_replicate_updates_as_insert_delete.js diff --git a/jstests/sharding/query/out_with_api_strict.js b/jstests/sharding/query/out_with_api_strict.js new file mode 100644 index 00000000000..5876e29402c --- /dev/null +++ b/jstests/sharding/query/out_with_api_strict.js @@ -0,0 +1,37 @@ +/** + * Tests that the $out stage executes correctly with apiStrict checking. + * @tags: [ + * requires_fcv_70, + * ] + */ +(function() { +"use strict"; + +const st = new ShardingTest({shards: 2, rs: {nodes: 1}}); +const sourceDB = st.s.getDB("test"); +const sourceColl = sourceDB.source; +const targetColl = sourceDB.target; + +sourceColl.drop(); + +st.shardColl(sourceColl, {_id: 1}, {_id: 0}, {_id: 1}, sourceDB.getName()); + +for (let i = 0; i < 10; i++) { + assert.commandWorked(sourceColl.insert({_id: i})); +} + +targetColl.drop(); + +// This command uses the internal field `temp` of the create command, which should now pass with +// `apiStrict: true`. +let result = sourceDB.runCommand({ + aggregate: sourceColl.getName(), + pipeline: [{$out: targetColl.getName()}], + cursor: {}, + apiVersion: "1", + apiStrict: true +}); +assert.commandWorked(result); + +st.stop(); +}()); diff --git a/src/mongo/db/commands/create.idl b/src/mongo/db/commands/create.idl index 8ab95c40f1f..0a1f8226454 100644 --- a/src/mongo/db/commands/create.idl +++ b/src/mongo/db/commands/create.idl @@ -198,10 +198,13 @@ commands: optional: true stability: stable temp: - description: "DEPRECATED" + description: "Internal field that can be used in the $out aggregation code." type: safeBool optional: true - stability: unstable + # The temp field is an internal field and not documented publicly, but we need to set + # the 'stability' to 'stable' because it can be used in the $out aggregation stage. + # This is due to the limitation of the API strict checking infrastructure. + stability: stable flags: description: "DEPRECATED" type: safeInt64 |