Created
December 15, 2011 23:14
-
-
Save willf/1483419 to your computer and use it in GitHub Desktop.
Mongo DB get accessors and how the act in the presence of a missing key/value pair
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> new BasicDBObject().get("missing") => java.lang.Object = null | |
scala> new BasicDBObject().getBoolean("missing") => Boolean = false | |
scala> new BasicDBObject().getDouble("missing") throws java.lang.NullPointerException | |
scala> new BasicDBObject().getInt("missing") throws java.lang.NullPointerException | |
scala> new BasicDBObject().getLong("missing") throws java.lang.NullPointerException | |
scala> new BasicDBObject().getString("missing") => java.lang.String = null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment