[SERVER-33297] mongos create will make a capped collection with size 0 if not specified Created: 13/Feb/18  Updated: 29/Oct/23  Resolved: 24/Apr/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.7.7

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Randolph Tan
Resolution: Fixed Votes: 0
Labels: pm-1051-legacy-tickets
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2018-03-26, Sharding 2018-04-09, Sharding 2018-05-07
Participants:

 Description   

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"
}



 Comments   
Comment by Githook User [ 24/Apr/18 ]

Author:

{'email': 'randolph@10gen.com', 'username': 'renctan', 'name': 'Randolph Tan'}

Message: SERVER-33297 mongos create will make a capped collection with size 0 if not specified
Branch: master
https://github.com/mongodb/mongo/commit/2d77fd7d723e98e9dc398aea0c6d639e322dc691

Generated at Thu Feb 08 04:32:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.