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

Option "size" for capped collections

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 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());
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            uladzimir_mihura@epam.com Uladzimir Mihura
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: