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() {
1352
1352
public boolean isCapped () {
1353
1353
CommandResult stats = getStats ();
1354
1354
Object capped = stats .get ("capped" );
1355
- return (capped != null && (Integer ) capped == 1 );
1355
+ return (capped != null && ( capped . equals ( 1 ) || capped . equals ( true ) ) );
1356
1356
}
1357
1357
1358
1358
// ------
Original file line number Diff line number Diff line change @@ -48,6 +48,21 @@ public void testMultiInsert() {
48
48
c .insert (new DBObject [] {inserted1 ,inserted2 });
49
49
}
50
50
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
+
51
66
@ Test (groups = {"basic" })
52
67
public void testDuplicateKeyException () {
53
68
DBCollection c = _db .getCollection ("testDuplicateKey" );
You can’t perform that action at this time.
0 commit comments