summaryrefslogtreecommitdiff
path: root/jstests/parallel/fsm_example_inheritance.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/parallel/fsm_example_inheritance.js')
-rw-r--r--jstests/parallel/fsm_example_inheritance.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/parallel/fsm_example_inheritance.js b/jstests/parallel/fsm_example_inheritance.js
new file mode 100644
index 00000000000..e8e5452da3a
--- /dev/null
+++ b/jstests/parallel/fsm_example_inheritance.js
@@ -0,0 +1,18 @@
+load('jstests/parallel/fsm_libs/runner.js'); // for extendWorkload
+load('jstests/parallel/fsm_example.js'); // for $config
+
+// extendWorkload takes a $config object and a callback, and returns an extended $config object.
+var $config = extendWorkload($config, function($config, $super) {
+ // In the callback, $super is the base workload definition we're extending,
+ // and $config is the extended workload definition we're creating.
+
+ // You can replace any properties on $config, including methods you want to override.
+ $config.setup = function(db, collName) {
+ // Overridden methods should usually call the corresponding method on $super.
+ $super.setup.apply(this, arguments);
+
+ db[collName].ensureIndex({ exampleIndexedField: 1 });
+ };
+
+ return $config;
+});