0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 16:46:00 +01:00
mongodb/jstests/noPassthrough/missing_shard_key.js
auto-revert-app[bot] 8dabd67451 Revert "SERVER-92880 Tag more jstests as owned by query (#29090)" (#29523)
GitOrigin-RevId: d5a1fb056144efac5baf4b3c0b4166ac3bc7944e
2024-11-23 09:10:19 +00:00

19 lines
562 B
JavaScript

/**
* Verify that a query requiring shard filtering handles missing shard keys properly.
*/
import {ShardingTest} from "jstests/libs/shardingtest.js";
const st = new ShardingTest({
shards: 1,
});
const dbName = "foo";
const ns = "foo.bar";
assert.commandWorked(st.s.adminCommand({enableSharding: dbName}));
assert.commandWorked(st.s.adminCommand({shardCollection: ns, key: {skey: 1}}));
assert.commandWorked(st.s.getCollection(ns).insert({_id: 1, x: 1}));
assert.sameMembers(st.s.getCollection(ns).find({x: 1}).toArray(), [{_id: 1, x: 1}]);
st.stop();