blob: 4554ea2dc76860ffcfb1eef472c1e61cc664ed61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
(function() {
// Test applyOps behavior for view creation.
"use strict";
const replTest = new ReplSetTest({nodes: 1});
replTest.startSet();
replTest.initiate();
const db = replTest.getPrimary().getDB('test');
assert.commandWorked(db.createCollection("bar"));
assert.writeOK(db.bar.insert({a: 1, b: "hi"}));
const cmd = {applyOps: [{op: "c", ns: db + ".$cmd", o: {create: "foo", viewOn: "bar"}}]};
assert.commandWorked(db.runCommand(cmd), tojson(cmd));
assert.eq(db.foo.findOne({a: 1}).b, "hi");
}());
|