diff options
Diffstat (limited to 'jstests/replsets/view_catalog_oplog_entries.js')
-rw-r--r-- | jstests/replsets/view_catalog_oplog_entries.js | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/jstests/replsets/view_catalog_oplog_entries.js b/jstests/replsets/view_catalog_oplog_entries.js index d245a84b897..a39a3f521de 100644 --- a/jstests/replsets/view_catalog_oplog_entries.js +++ b/jstests/replsets/view_catalog_oplog_entries.js @@ -4,45 +4,45 @@ */ (function() { - "use strict"; +"use strict"; - const dbName = "view_catalog_oplog_entries"; - const collName = "test_coll"; - const viewName = "test_view"; +const dbName = "view_catalog_oplog_entries"; +const collName = "test_coll"; +const viewName = "test_view"; - const replTest = new ReplSetTest({nodes: 1}); - replTest.startSet(); - replTest.initiate(); +const replTest = new ReplSetTest({nodes: 1}); +replTest.startSet(); +replTest.initiate(); - const primary = replTest.getPrimary(); +const primary = replTest.getPrimary(); - assert.commandWorked(primary.getDB(dbName)[collName].insert({a: 1})); +assert.commandWorked(primary.getDB(dbName)[collName].insert({a: 1})); - // Create the view. - assert.commandWorked(primary.getDB(dbName).createView(viewName, collName, [])); +// Create the view. +assert.commandWorked(primary.getDB(dbName).createView(viewName, collName, [])); - // Modify the view with the "collMod" command. - assert.commandWorked(primary.getDB(dbName).runCommand( - {collMod: viewName, viewOn: collName, pipeline: [{$project: {a: 1}}]})); +// Modify the view with the "collMod" command. +assert.commandWorked(primary.getDB(dbName).runCommand( + {collMod: viewName, viewOn: collName, pipeline: [{$project: {a: 1}}]})); - // There should be exactly one insert into "system.views" for the view creation... - const oplog = primary.getDB("local").oplog.rs; - const createViewOplogEntry = oplog.find({op: "i", ns: (dbName + ".system.views")}).toArray(); - assert.eq(createViewOplogEntry.length, 1); - assert(createViewOplogEntry[0].hasOwnProperty("ui"), - "Oplog entry for view creation missing UUID for view catalog: " + - tojson(createViewOplogEntry[0])); - const viewCatalogUUID = createViewOplogEntry[0].ui; +// There should be exactly one insert into "system.views" for the view creation... +const oplog = primary.getDB("local").oplog.rs; +const createViewOplogEntry = oplog.find({op: "i", ns: (dbName + ".system.views")}).toArray(); +assert.eq(createViewOplogEntry.length, 1); +assert(createViewOplogEntry[0].hasOwnProperty("ui"), + "Oplog entry for view creation missing UUID for view catalog: " + + tojson(createViewOplogEntry[0])); +const viewCatalogUUID = createViewOplogEntry[0].ui; - // ...and exactly one update on "system.views" for the view collMod. - const modViewOplogEntry = oplog.find({op: "u", ns: (dbName + ".system.views")}).toArray(); - assert.eq(modViewOplogEntry.length, 1); - assert(modViewOplogEntry[0].hasOwnProperty("ui"), - "Oplog entry for view modification missing UUID for view catalog: " + - tojson(modViewOplogEntry[0])); +// ...and exactly one update on "system.views" for the view collMod. +const modViewOplogEntry = oplog.find({op: "u", ns: (dbName + ".system.views")}).toArray(); +assert.eq(modViewOplogEntry.length, 1); +assert(modViewOplogEntry[0].hasOwnProperty("ui"), + "Oplog entry for view modification missing UUID for view catalog: " + + tojson(modViewOplogEntry[0])); - // Both entries should have the same UUID. - assert.eq(viewCatalogUUID, modViewOplogEntry[0].ui); +// Both entries should have the same UUID. +assert.eq(viewCatalogUUID, modViewOplogEntry[0].ui); - replTest.stopSet(); +replTest.stopSet(); }()); |