|
Should we create an additional issue?
Python on Ubuntu 11.04 x64. We can create capped collection with negative size. And we can create such collection multiple times. After that we can't drop it.
import pymongo
|
|
args = {"name": "tmpcoll2", "options": { "capped": True, "size":-1, "max":6} }
|
db = pymongo.Connection().testdb
|
|
db.create_collection(**args)
|
# Exception has been generated, but collection created successfully.
|
Also we can reproduce this bug with shell
MongoDB shell version: 2.0.2
|
connecting to: test
|
> use testdb
|
switched to db testdb
|
> db.dropDatabase()
|
{ "dropped" : "testdb", "ok" : 1 }
|
> db.getCollectionNames()
|
[ ]
|
> db.createCollection("tmp1", {capped: true, size: -1})
|
{
|
"errmsg" : "exception: create collection invalid size spec",
|
"code" : 10083,
|
"ok" : 0
|
}
|
> db.getCollectionNames()
|
[ "tmp1" ]
|
> db.createCollection("tmp1", {capped: true, size: -1})
|
{
|
"errmsg" : "exception: create collection invalid size spec",
|
"code" : 10083,
|
"ok" : 0
|
}
|
> db.getCollectionNames()
|
[ "tmp1", "tmp1" ]
|
> db.createCollection("tmp1", {capped: true, size: -1})
|
{
|
"errmsg" : "exception: create collection invalid size spec",
|
"code" : 10083,
|
"ok" : 0
|
}
|
> db.getCollectionNames()
|
[ "tmp1", "tmp1", "tmp1" ]
|
> db.tmp1.drop()
|
false
|
> db.getCollectionNames()
|
[ "tmp1", "tmp1", "tmp1" ]
|
|
|
Also we can see similar bug with Python
import pymongo
|
|
args = {"name": "tmpcoll", "options": { "capped": True, "size":5, "max":6} }
|
db = pymongo.Connection().testdb
|
db.create_collection(**args)
|
|
to_ins = []
|
to_ins.append({"field": "some string for add 1"})
|
to_ins.append({"field": "some string for add 2"})
|
to_ins.append({"field": "some string for add 3"})
|
|
db.tmpcoll.insert(to_ins, safe=True)
|
|
# Now we can find our three strings in collection "tmpcoll" as we inserted. The size of collection is 168b.
|
# But we mustn't find them, because collection creates as capped with size 5b
|
|