mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-24 16:46:00 +01:00
8dabd67451
GitOrigin-RevId: d5a1fb056144efac5baf4b3c0b4166ac3bc7944e
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();
|