load('jstests/libs/write_concern_util.js');
|
load('jstests/libs/uuid_util.js');
|
var rst = new ReplSetTest({nodes: 2});
|
rst.startSet();
|
rst.initiate();
|
|
var primary = rst.nodes[0];
|
var secondary = rst.nodes[1];
|
|
var db = primary.getDB('test');
|
var collName = 'foo';
|
|
stopReplicationOnSecondaries(rst);
|
|
function printCollections() {
|
printjson(db.runCommand({listCollections: 1, includePendingDrops: 1}));
|
}
|
|
assert.writeOK(db[collName].insert({a:1}));
|
var uuid = getUUIDFromListCollections(db, collName);
|
|
jsTestLog("Drop");
|
printCollections();
|
assert.commandWorked(db.runCommand({drop: collName}));
|
printCollections();
|
var cursor = db.runCommand({find: uuid});
|
printjson(cursor);
|
assert.eq(1, cursor.cursor.firstBatch.length);
|
|
jsTestLog("Apply Ops with UUID on drop pending collection");
|
printCollections();
|
assert.commandWorked(primary.adminCommand({ "applyOps" : [ { "op" : "c", "ns" : "test.$cmd", "ui" : uuid, "o" : { "drop" : collName } } ] }));
|
printCollections();
|
cursor = db.runCommand({find: uuid});
|
printjson(cursor);
|
assert.eq(1, cursor.cursor.firstBatch.length);
|