创建capped collection

记录下使用mongo 或者morphia 创建限额的collection

 

 

mongoDB

DBObject options = new BasicDBObject();
options.put("capped", true);
options.put("size", 100000);
options.put("max", 100);

DBCollection coll = db.createCollection("test", options);
 

 

 

morphia

@Entity(noClassnameStored=true,cap=@CappedAt(count=100,value=10000))
 

 

 


你可能感兴趣的:(mongodb)