blob: 2850b7f4e4e5e3befff0395eec9ef262a2d0613f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/**
* Tests that the deprecated 'hash' oplog entry field is silently stripped in applyOps.
*/
(function() {
"use strict";
const rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
const dbName = "testDB";
const collName = "testColl";
const primary = rst.getPrimary();
const primaryDB = primary.getDB(dbName);
jsTestLog("Creating collection explicitly");
assert.commandWorked(primaryDB.runCommand({create: collName}));
jsTestLog("Running applyOps command");
assert.commandWorked(primaryDB.runCommand(
{applyOps: [{op: "i", ns: dbName + "." + collName, o: {_id: "mustStripHash"}, h: 0}]}));
jsTestLog("Verifying result of applyOps");
const entry = primary.getDB("local").oplog.rs.find({"o._id": "mustStripHash"}).next();
assert(!entry.hasOwnProperty("h"), () => tojson(entry));
rst.stopSet();
})();
|