mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-21 20:49:10 +01:00
771dabd098
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
33 lines
954 B
JavaScript
33 lines
954 B
JavaScript
/**
|
|
* Test initial sync cloning of a collection that contains a multikey index.
|
|
*/
|
|
import {ReplSetTest} from "jstests/libs/replsettest.js";
|
|
|
|
const replTest = new ReplSetTest({nodes: 1});
|
|
replTest.startSet();
|
|
replTest.initiate();
|
|
|
|
const dbName = jsTest.name();
|
|
const collName = "test";
|
|
|
|
const primary = replTest.getPrimary();
|
|
const primaryDB = primary.getDB(dbName);
|
|
|
|
jsTestLog("Creating the collection and an index.");
|
|
assert.commandWorked(primaryDB.createCollection(collName));
|
|
assert.commandWorked(primaryDB[collName].createIndex({"x": 1}));
|
|
|
|
// Make the index multikey.
|
|
primaryDB[collName].insert({x: [1, 2]});
|
|
|
|
jsTestLog("Adding a secondary node to do the initial sync.");
|
|
replTest.add();
|
|
|
|
jsTestLog("Re-initiating replica set with the new secondary.");
|
|
replTest.reInitiate();
|
|
|
|
// Wait until initial sync completes.
|
|
jsTestLog("Waiting until initial sync completes.");
|
|
replTest.awaitSecondaryNodes();
|
|
replTest.awaitReplication();
|
|
replTest.stopSet(); |