mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
16 lines
450 B
JavaScript
16 lines
450 B
JavaScript
const waitForCommand = function(waitingFor, opFilter, myDB) {
|
|
let opId = -1;
|
|
assert.soon(function() {
|
|
print(`Checking for ${waitingFor}`);
|
|
const curopRes = myDB.currentOp();
|
|
assert.commandWorked(curopRes);
|
|
const foundOp = curopRes["inprog"].filter(opFilter);
|
|
|
|
if (foundOp.length == 1) {
|
|
opId = foundOp[0]["opid"];
|
|
}
|
|
return (foundOp.length == 1);
|
|
});
|
|
return opId;
|
|
};
|