Skip to content

Commit 306693a

Browse files
committed
* Support for Dot notation in documents
* extend Document functions with getValue. updateValue, getIntValue ... (with dot support)
1 parent d9039df commit 306693a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/scala/com/sfxcode/nosql/mongo/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ package object mongo extends MongoIncludes with DocumentIncludes {
4646
val value = getValue(key)
4747
value match {
4848
case n: Number => n.longValue()
49-
case s: String => s.toLongOption.getOrElse(0)
49+
case s: String => s.toLong
5050
case _ => 0
5151
}
5252
}
@@ -56,7 +56,7 @@ package object mongo extends MongoIncludes with DocumentIncludes {
5656
def getDoubleValue(key: String): Double =
5757
getValue(key) match {
5858
case n: Number => n.doubleValue()
59-
case s: String => s.toDoubleOption.getOrElse(0)
59+
case s: String => s.toDouble
6060
case _ => 0
6161
}
6262

0 commit comments

Comments
 (0)