Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33046

Test "create" and "drop" commands on views with applyOps.

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            backlog-server-repl Backlog - Replication Team
            Reporter:
            shane.harvey Shane Harvey
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: