Capped collections using MongoDB and SpringData
===

I am trying to create a capped collection for logging using mongoTemplate. However my collection size is growing beyond the size I passed as arguments. Can anyone please help with this.

    
    public synchronized MongoTemplate getTemplate() {

		if (template == null) {
			Mongo mongo = null;
			mongo = new Mongo(addrs);
			template = new MongoTemplate(mongo, this.dbName);
			
			if(!template.collectionExists(HttpRequestEntity.class)){
				CollectionOptions options = new CollectionOptions(4,4,true);
		        template.createCollection(HttpRequestEntity.class, options);
			}	
		}

		return template;
	}

For saving I am calling save on this template instance

    getTemplate().save(entity);