Document Null pointer exception being thrown for BasicBSONObject.getLong() and .getInt()

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Documentation
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Document that when the field is either not existent, or not a number, it throws an NullPointer exception

      BasicDBObject dbo = new BasicDBObject();
      System.out.println(dbo.get("A"));       // => null
      System.out.println(dbo.getString("A")); // => null
      System.out.println(dbo.getDate("A"));   // => null
      System.out.println(dbo.getLong("A"));   // => throws NullPointer
      System.out.println(dbo.getInt("A"));    // => throws NullPointer
      

      links:
      http://api.mongodb.org/java/2.0/org/bson/BasicBSONObject.html#getLong(java.lang.String)
      http://api.mongodb.org/java/2.0/org/bson/BasicBSONObject.html#getInt(java.lang.String)

            Assignee:
            Unassigned
            Reporter:
            Gianfranco Palumbo (Inactive)
            None
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: