com.mongodb
Interface DBObject

All Known Implementing Classes:
BasicDBList, BasicDBObject, GridFSDBFile, GridFSFile, GridFSInputFile, RawDBObject, ReflectionDBObject

public interface DBObject

A key-value map that can be saved to the database.


Method Summary
 boolean containsField(String s)
          Checks if this object contains a field with the given name.
 boolean containsKey(String s)
          Deprecated.  
 Object get(String key)
          Gets a field from this object by a given name.
 boolean isPartialObject()
          whether markAsPartialObject was ever called only matters if you are going to upsert and dont' want to risk losing fields
 Set<String> keySet()
          Returns this object's fields' names
 void markAsPartialObject()
          if this object was loaded with only some fields (using a field filter) this method will be called to notify
 Object put(String key, Object v)
          Sets a name/value pair in this object.
 void putAll(DBObject o)
           
 void putAll(Map m)
           
 Object removeField(String key)
          Remove a field with a given name from this object.
 Map toMap()
          Returns a map representing this DBObject.
 

Method Detail

put

Object put(String key,
           Object v)
Sets a name/value pair in this object.

Parameters:
key - Name to set
v - Corresponding value
Returns:
v

putAll

void putAll(DBObject o)

putAll

void putAll(Map m)

get

Object get(String key)
Gets a field from this object by a given name.

Parameters:
key - The name of the field fetch
Returns:
The field, if found

toMap

Map toMap()
Returns a map representing this DBObject.

Returns:
the map

removeField

Object removeField(String key)
Remove a field with a given name from this object.

Parameters:
key - The name of the field to remove
Returns:
The value removed from this object

containsKey

boolean containsKey(String s)
Deprecated. 


containsField

boolean containsField(String s)
Checks if this object contains a field with the given name.

Parameters:
s - Field name for which to check
Returns:
if this object contains a field with the given name

keySet

Set<String> keySet()
Returns this object's fields' names

Returns:
The names of the fields in this object

markAsPartialObject

void markAsPartialObject()
if this object was loaded with only some fields (using a field filter) this method will be called to notify


isPartialObject

boolean isPartialObject()
whether markAsPartialObject was ever called only matters if you are going to upsert and dont' want to risk losing fields