-
Type:
Task
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Replication
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Please add a test that creating and dropping views works with applyOps.
For example, applying a "create" oplog entry should create a view:
> db.adminCommand({applyOps: [{"op" : "c", "ns" : "test.$cmd", "o" : { "create" : "viewColl", "viewOn" : "test", "pipeline" : [ ] } }]}); { "applied" : 1, "results" : [ true ], "ok" : 1 } > db.getCollectionInfos({name:"viewColl"}) [ { "name" : "viewColl", "type" : "view", "options" : { "viewOn" : "test", "pipeline" : [ ] }, "info" : { "readOnly" : true } } ]
Applying a "drop" oplog entry should delete the view:
> db.adminCommand({applyOps: [{op:"c", ns: "test.$cmd", o:{"drop":"viewColl"}}]}) { "applied" : 1, "results" : [ true ], "ok" : 1 } > db.getCollectionInfos({name:"viewColl"}) [ ]
This currently works on 3.4 and 3.6.