Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Collection.isCapped() Compatability with Mongo 2.2.0

  • Loading branch information...
commit 79637285d1f063d0076c9cac5c1b556b3efe54b6 1 parent 4fd5f71
@breinero breinero authored
View
2  src/main/com/mongodb/DBCollection.java
@@ -1352,7 +1352,7 @@ public CommandResult getStats() {
public boolean isCapped() {
CommandResult stats = getStats();
Object capped = stats.get("capped");
- return(capped != null && (Integer)capped == 1);
+ return(capped != null && ( capped.equals(1) || capped.equals(true) ) );
}
// ------
View
15 src/test/com/mongodb/DBCollectionTest.java
@@ -49,6 +49,21 @@ public void testMultiInsert() {
}
@Test(groups = {"basic"})
+ public void testCappedCollection() {
+ String collectionName = "testCapped";
+ int collectionSize = 1000;
+
+ DBCollection c = _db.getCollection(collectionName);
+ c.drop();
+
+ DBObject options = new BasicDBObject("capped", true);
+ options.put("size", collectionSize);
+ c = _db.createCollection(collectionName, options);
+
+ assertEquals(c.isCapped(), true);
+ }
+
+ @Test(groups = {"basic"})
public void testDuplicateKeyException() {
DBCollection c = _db.getCollection("testDuplicateKey");
c.drop();
Please sign in to comment.
Something went wrong with that request. Please try again.