File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1352,7 +1352,7 @@ public CommandResult getStats() {
13521352 public boolean isCapped () {
13531353 CommandResult stats = getStats ();
13541354 Object capped = stats .get ("capped" );
1355- return (capped != null && (Integer ) capped == 1 );
1355+ return (capped != null && ( capped . equals ( 1 ) || capped . equals ( true ) ) );
13561356 }
13571357
13581358 // ------
Original file line number Diff line number Diff line change @@ -48,6 +48,21 @@ public void testMultiInsert() {
4848 c .insert (new DBObject [] {inserted1 ,inserted2 });
4949 }
5050
51+ @ Test (groups = {"basic" })
52+ public void testCappedCollection () {
53+ String collectionName = "testCapped" ;
54+ int collectionSize = 1000 ;
55+
56+ DBCollection c = _db .getCollection (collectionName );
57+ c .drop ();
58+
59+ DBObject options = new BasicDBObject ("capped" , true );
60+ options .put ("size" , collectionSize );
61+ c = _db .createCollection (collectionName , options );
62+
63+ assertEquals (c .isCapped (), true );
64+ }
65+
5166 @ Test (groups = {"basic" })
5267 public void testDuplicateKeyException () {
5368 DBCollection c = _db .getCollection ("testDuplicateKey" );
You can’t perform that action at this time.
0 commit comments