Skip to content

Commit 90addca

Browse files
committed
Ensure Int value for collection status
1 parent 5f4e237 commit 90addca

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
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.9
7+
- Ensure Int value for collection status
8+
69
### 2.0.8
710
* MongoDAO add method columnNames
811
* mongo-scala-driver [4.1.1](https://mongodb.github.io/mongo-java-driver/4.1/driver-scala/)

build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ libraryDependencies += "org.specs2" %% "specs2-core" % "4.10.5" % Test
5151

5252
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3" % Test
5353

54-
libraryDependencies += "joda-time" % "joda-time" % "2.10.6" % Test
54+
libraryDependencies += "joda-time" % "joda-time" % "2.10.8" % Test
5555

5656
libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.10" % Test
5757

5858
libraryDependencies += "org.mongodb.scala" %% "mongo-scala-driver" % "4.1.1"
5959

60-
libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.1.7.7" % Provided
60+
libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.1.8.1" % Provided
6161

62-
libraryDependencies += "com.github.luben" % "zstd-jni" % "1.4.5-7" % Provided
62+
libraryDependencies += "com.github.luben" % "zstd-jni" % "1.4.5-12" % Provided
6363

6464
val MongoJavaServerVersion = "1.36.0"
6565

@@ -69,7 +69,7 @@ libraryDependencies += "de.bwaldvogel" % "mongo-java-server-h2-backend" % MongoJ
6969

7070
libraryDependencies += "com.github.pathikrit" %% "better-files" % "3.9.1"
7171

72-
libraryDependencies += "com.typesafe" % "config" % "1.4.0"
72+
libraryDependencies += "com.typesafe" % "config" % "1.4.1"
7373

7474
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2"
7575

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.4.0
1+
sbt.version=1.4.3

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
1010

1111
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1")
1212

13-
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")
13+
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.6.1")
1414

1515
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
1616

@@ -21,6 +21,6 @@ addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.8.0")
2121

2222
addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0")
2323

24-
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
24+
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
2525

2626
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,24 @@ object CollectionStatus {
2828
map.getOrElse("ns", "-").toString,
2929
map.getOrElse("type", "Standard").toString,
3030
map.getOrElse("scaleFactor", 0).asInstanceOf[Int],
31-
map.getOrElse("size", 0).asInstanceOf[Int],
32-
map.getOrElse("count", 0).asInstanceOf[Int],
33-
map.getOrElse("storageSize", 0).asInstanceOf[Int],
34-
map.getOrElse("avgObjSize", 0).asInstanceOf[Int],
35-
map.getOrElse("nindexes", 0).asInstanceOf[Int],
31+
intValue(map, "size"),
32+
intValue(map, "count"),
33+
intValue(map, "storageSize"),
34+
intValue(map, "avgObjSize"),
35+
intValue(map, "nindexes"),
3636
map.getOrElse("indexSizes", Map()).asInstanceOf[Map[String, Int]],
37-
map.getOrElse("totalIndexSize", 0).asInstanceOf[Int],
38-
map.getOrElse("ok", 0).asInstanceOf[Double].toInt,
37+
intValue(map, "totalIndexSize"),
38+
intValue(map, "ok"),
3939
new Date(),
4040
map
4141
)
4242
}
43+
44+
def intValue(map: Map[String, Any], key: String): Int =
45+
map.getOrElse(key, 0) match {
46+
case i: Int => i
47+
case l: Long => l.intValue()
48+
case d: Double => d.intValue()
49+
case _ => 0
50+
}
4351
}

version.sbt

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

0 commit comments

Comments
 (0)