We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c6eb27 commit 32e57afCopy full SHA for 32e57af
src/main/org/bson/BasicBSONObject.java
@@ -158,6 +158,19 @@ public String getString( String key ){
158
return foo.toString();
159
}
160
161
+ /** Returns the value of a field as a boolean.
162
+ * @param key the field to look up
163
+ * @return the value of the field, or false if field does not exist
164
+ */
165
+ public boolean getBoolean( String key ){
166
+ return getBoolean(key, false);
167
+ }
168
+
169
+ /** Returns the value of a field as a boolean
170
171
+ * @param def the default value in case the field is not found
172
+ * @return the value of the field, converted to a string
173
174
public boolean getBoolean( String key , boolean def ){
175
Object foo = get( key );
176
if ( foo == null )
0 commit comments