summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/api_version_test_expression.js8
-rw-r--r--jstests/sharding/libs/mongos_api_params_util.js24
2 files changed, 32 insertions, 0 deletions
diff --git a/jstests/sharding/api_version_test_expression.js b/jstests/sharding/api_version_test_expression.js
index de6c83f68a4..bf5dffc7b6e 100644
--- a/jstests/sharding/api_version_test_expression.js
+++ b/jstests/sharding/api_version_test_expression.js
@@ -113,5 +113,13 @@ assert.commandWorked(db.runCommand({
apiDeprecationErrors: false,
apiVersion: "1"
}));
+
+// Create a view with {apiStrict: true}.
+db.view.drop();
+assert.commandWorked(db.runCommand(
+ {create: "view", viewOn: collName, pipeline: [], apiStrict: true, apiVersion: "1"}));
+// find() on views should work normally if 'apiStrict' is true.
+assert.commandWorked(db.runCommand({find: "view", apiStrict: true, apiVersion: "1"}));
+
st.stop();
})();
diff --git a/jstests/sharding/libs/mongos_api_params_util.js b/jstests/sharding/libs/mongos_api_params_util.js
index 6ec941b9266..fb2fe5b9231 100644
--- a/jstests/sharding/libs/mongos_api_params_util.js
+++ b/jstests/sharding/libs/mongos_api_params_util.js
@@ -525,6 +525,30 @@ let MongosAPIParametersUtil = (function() {
}
},
{
+ commandName: "find",
+ run: {
+ inAPIVersion1: true,
+ shardCommandName: "find",
+ setUp: function() {
+ st.s.getDB("db")["view"].drop();
+ assert.commandWorked(st.s.getDB("db").runCommand(
+ {create: "view", viewOn: "collection", pipeline: []}));
+ },
+ command: () => ({find: "view", filter: {x: 1}})
+ },
+ explain: {
+ inAPIVersion1: true,
+ shardCommandName: "explain",
+ permittedInTxn: false,
+ setUp: function() {
+ st.s.getDB("db")["view"].drop();
+ assert.commandWorked(st.s.getDB("db").runCommand(
+ {create: "view", viewOn: "collection", pipeline: []}));
+ },
+ command: () => ({explain: {find: "view", filter: {x: 1}}})
+ }
+ },
+ {
commandName: "findAndModify",
run: {
inAPIVersion1: true,