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

changeStream cursor is not returned on a mongos when the database does not exist

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.6.0-rc3
    • Fix Version/s: 3.6.1, 3.7.1
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.6
    • Sprint:
      Query 2017-12-18

      Description

      On a replica set a changeStream cursor can be created on a collection where the database does not exist yet:

      > db.dropDatabase()
      { "ok" : 1, "operationTime" : Timestamp(1510184057, 1) }
      > db.runCommand({"aggregate":"database-does-not-exist", "pipeline":[{'$changeStream': {}}], "cursor": {}})
      {
      	"cursor" : {
      		"firstBatch" : [ ],
      		"id" : NumberLong("5437951372965323737"),
      		"ns" : "test.database-does-not-exist"
      	},
      	"ok" : 1,
      	"operationTime" : Timestamp(1510184077, 1)
      }
      

      The same operation on a mongos does not return a cursor:

      MongoDB Enterprise mongos> db.dropDatabase()
      {
      	"dropped" : "test",
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1510184413, 9),
      		"signature" : {
      			"hash" : BinData(0,"lFkT1OPozsQoRVqqU/5bXxUNhng="),
      			"keyId" : NumberLong("6486191337619062789")
      		}
      	},
      	"operationTime" : Timestamp(1510184413, 9)
      }
      MongoDB Enterprise mongos> db.runCommand({"aggregate":"database-does-not-exist", "pipeline":[{'$changeStream': {}}], "cursor": {}})
      {
      	"result" : [ ],
      	"cursor" : {
      		"id" : NumberLong(0),
      		"ns" : "test.database-does-not-exist",
      		"firstBatch" : [ ]
      	},
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1510184417, 1),
      		"signature" : {
      			"hash" : BinData(0,"KsuOoKtQYUkl2peKWjMv4kJHzzE="),
      			"keyId" : NumberLong("6486191337619062789")
      		}
      	},
      	"operationTime" : Timestamp(1510184417, 1)
      }
      

      This is surprising when combined with the fact that wired tiger drops databases when there are no more collections.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: