public class BasicDBObject extends BasicBSONObject implements DBObject
DBObject can be created as follows, using this class:
DBObject obj = new BasicDBObject(); obj.put( "foo", "bar" );
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
BasicDBObject()
Creates an empty object.
|
BasicDBObject(int size)
creates an empty object
|
BasicDBObject(Map m)
Creates an object from a map.
|
BasicDBObject(String key,
Object value)
creates an object with the given key/value
|
| Modifier and Type | Method and Description |
|---|---|
BasicDBObject |
append(String key,
Object val)
Add a key/value pair to this object
|
Object |
copy() |
boolean |
isPartialObject()
whether markAsPartialObject was ever called
only matters if you are going to upsert and do not want to risk losing fields
|
void |
markAsPartialObject()
if this object was retrieved with only some fields (using a field filter)
this method will be called to mark it as such.
|
String |
toString()
Returns a JSON serialization of this object
|
containsField, containsKey, equals, get, getBoolean, getBoolean, getDate, getDate, getDouble, getDouble, getInt, getInt, getLong, getLong, getObjectId, getObjectId, getString, getString, put, putAll, putAll, removeField, toMapclear, containsValue, get, removeEldestEntryclone, containsKey, entrySet, isEmpty, keySet, remove, size, valueshashCodefinalize, getClass, notify, notifyAll, wait, wait, waitcontainsField, containsKey, get, keySet, put, putAll, putAll, removeField, toMappublic BasicDBObject()
public BasicDBObject(int size)
size - an estimate of number of fields that will be insertedpublic BasicDBObject(String key, Object value)
key - key under which to storevalue - value to storpublic BasicDBObject(Map m)
m - map to convertpublic boolean isPartialObject()
DBObjectisPartialObject in interface DBObjectpublic void markAsPartialObject()
DBObjectmarkAsPartialObject in interface DBObjectpublic String toString()
toString in class BasicBSONObjectpublic BasicDBObject append(String key, Object val)
BasicBSONObjectappend in class BasicBSONObjectkey - the field nameval - the field valuethispublic Object copy()