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

mongos create will make a capped collection with size 0 if not specified

    • Fully Compatible
    • ALL
    • Sharding 2018-03-26, Sharding 2018-04-09, Sharding 2018-05-07

      Shell repro on master :

      mongos> db.version()
      3.7.1-340-gf2e1688
      MongoDB Enterprise > db.runCommand({create : "cappedColl", capped : true})
      {
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1518546909, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1518546901, 2)
      }
      MongoDB Enterprise > db.getCollectionInfos()
      [
      	{
      		"name" : "cappedColl",
      		"type" : "collection",
      		"options" : {
      			"capped" : true,
      			"size" : 0
      		},
      		"info" : {
      			"readOnly" : false,
      			"uuid" : UUID("ec90615e-a802-4529-a83f-e1e8163503a6")
      		},
      		"idIndex" : {
      			"v" : 2,
      			"key" : {
      				"_id" : 1
      			},
      			"name" : "_id_",
      			"ns" : "JavaDriverTest.cappedColl"
      		}
      	}
      ]
      

      The current behavior in 3.6 (and the behavior of replica sets on master), is that creating a capped collection without a size specified is an error:

      MongoDB Enterprise > db.runCommand({create : "cappedColl", capped : true})
      {
      	"ok" : 0,
      	"errmsg" : "specify size:<n> when capped is true",
      	"code" : 14832,
      	"codeName" : "Location14832"
      }
      

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: