BSONObject (bson 5.4.0 API) (original) (raw)
All Known Implementing Classes:
[BasicBSONList](types/BasicBSONList.html "class in org.bson.types")
, [BasicBSONObject](BasicBSONObject.html "class in org.bson")
, [LazyBSONList](LazyBSONList.html "class in org.bson")
, [LazyBSONObject](LazyBSONObject.html "class in org.bson")
public interface BSONObject
A key-value map that can be saved to the database.
Method Summary
boolean
Checks if this object contains a field with the given name.
Gets a field from this object by a given name.[keySet](#keySet%28%29)()
Returns this object's fields' names
Sets a name/value pair in this object.void
Sets all key/value pairs from a map into this objectvoid
Sets all key/value pairs from an object into this object
Removes a field with a given name from this object.[toMap](#toMap%28%29)()
Returns a map representing this BSONObject.
Method Details
put
Sets a name/value pair in this object.
Parameters:
key
- Name to set
v
- Corresponding value
Returns:
the previous value associated withkey
, ornull
if there was no mapping forkey
. (Anull
return can also indicate that the map previously associatednull
withkey
.)putAll
Sets all key/value pairs from an object into this object
Parameters:
o
- the objectputAll
void putAll(Map m)
Sets all key/value pairs from a map into this object
Parameters:
m
- the mapget
Gets a field from this object by a given name.
Parameters:
key
- The name of the field fetch
Returns:
The field, if foundtoMap
Returns a map representing this BSONObject.
Returns:
the mapremoveField
Removes a field with a given name from this object.
Parameters:
key
- The name of the field to remove
Returns:
The value removed from this objectcontainsField
boolean containsField(String s)
Checks if this object contains a field with the given name.
Parameters:
s
- Field name for which to check
Returns:
True if the field is presentkeySet
Returns this object's fields' names
Returns:
The names of the fields in this object