Skip to content

Commit 020701d

Browse files
committed
Size, Storagesize needs Double
1 parent 42e1918 commit 020701d

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
## Versions
55

6+
### 2.0.10
7+
- Size, Storagesize needs Double
8+
69
### 2.0.9
710
- Ensure Int value for collection status
811

src/main/scala/com/sfxcode/nosql/mongo/database/CollectionStatus.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ case class CollectionStatus(
1111
scaleFactor: Int,
1212
size: Double,
1313
count: Int,
14-
storageSize: Int,
14+
storageSize: Double,
1515
avgObjSize: Int,
1616
nindexes: Int,
1717
indexSizes: Map[String, Int],
@@ -28,9 +28,9 @@ object CollectionStatus {
2828
map.getOrElse("ns", "-").toString,
2929
map.getOrElse("type", "Standard").toString,
3030
map.getOrElse("scaleFactor", 0).asInstanceOf[Int],
31-
intValue(map, "size"),
31+
doubleValue(map, "size"),
3232
intValue(map, "count"),
33-
intValue(map, "storageSize"),
33+
doubleValue(map, "storageSize"),
3434
intValue(map, "avgObjSize"),
3535
intValue(map, "nindexes"),
3636
map.getOrElse("indexSizes", Map()).asInstanceOf[Map[String, Int]],
@@ -48,4 +48,12 @@ object CollectionStatus {
4848
case d: Double => d.intValue()
4949
case _ => 0
5050
}
51+
52+
def doubleValue(map: Map[String, Any], key: String): Double =
53+
map.getOrElse(key, 0) match {
54+
case i: Int => i.doubleValue()
55+
case l: Long => l.doubleValue()
56+
case d: Double => d
57+
case _ => 0
58+
}
5159
}

version.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version in ThisBuild := "2.0.10-SNAPSHOT"
1+
version in ThisBuild := "2.0.10"

0 commit comments

Comments
 (0)