-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
In docs:
Unlike a standard collection, you must explicitly create a capped collection, specifying a collection size in bytes. The collection's data space is then preallocated. Note that the size specified includes database headers.
But if we take a look at the following code, the insertion of document that larger 10 bytes is possible:
Mongo m = new Mongo(); DB db = m.getDB("test"); db.createCollection("cn", BasicDBObjectBuilder.start() .add("size", 10) .add("capped", true) .get()); DBCollection collection = db.getCollection("cn"); collection.insert(BasicDBObjectBuilder.start() .add("field", "datadatadatadatadatadatadatadata") .add("maxLong", Long.MAX_VALUE) .add("minLong", Long.MIN_VALUE) .get() ); System.out.println(collection.findOne());