You are browsing a version that has not yet been released.
Capped collections are fixed sized collections that have a very high performance auto-LRU age-out feature (age out is based on insertion order).
In addition, capped collections automatically, with high performance, maintain insertion order for the objects in the collection; this is very powerful for certain use cases such as logging.
You can configure the collection in the
collection attribute of
1 <doctrine-mongo-mapping xmlns="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping.xsd"> <document name="Documents\Category" collection="collname" capped-collection="true" capped-collection-size="100000" capped-collection-max="1000"> <id /> <field field-name="name" type="string" /> </document> </doctrine-mongo-mapping> 2 3 4 5 6 7 8 9 10
Remember that you must manually create the collections. If you let
MongoDB create the collection lazily the first time it is selected,
it will not be created with the capped configuration. You can
create the collection for a document with the
that can be acquired from your
You can drop the collection too if it already exists:
odm:schema:create command to create the database schema:
$ php mongodb.php odm:schema:create
It must not exist when the command is invoked. It is not possible to convert an existing collection to a capped one using Doctrine. It is, however, possible to convert it by calling a direct Mongo command.