mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-27 23:27:11 +01:00
771dabd098
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
19 lines
562 B
JavaScript
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();
|