Public Member Functions | |
Object | put (String key, Object v) |
Object | put (int key, Object v) |
void | putAll (Map m) |
void | putAll (BSONObject o) |
Object | get (String key) |
Object | removeField (String key) |
boolean | containsKey (String key) |
boolean | containsField (String key) |
Set< String > | keySet () |
Map | toMap () |
Object | asList () |
Utility class to allow array DBObject
s to be created.
Note: MongoDB will also create arrays from java.util.List
s.
DBObject obj = new BasicBSONList(); obj.put("0", value1); obj.put("4", value2); obj.put(2, value3);
This simulates the array [ value1, null, value3, null, value2 ] by creating the DBObject
{ "0" : value1, "1" : null, "2" : value3, "3" : null, "4" : value2 }
BasicBSONList only supports numeric keys. Passing strings that cannot be converted to ints will cause an IllegalArgumentException.
BasicBSONList list = new BasicBSONList(); list.put("1", "bar"); // ok list.put("1E1", "bar"); // throws exception
|
inline |
|
inline |
Gets a value at an index. For interface compatibility. Must be passed a String that is parsable to an int.
key | the index |
IllegalArgumentException | if key cannot be parsed into an int |
|
inline |
Puts a value at an index. For interface compatibility. Must be passed a String that is parsable to an int.
key | the index at which to insert the value |
v | the value to insert |
IllegalArgumentException | if key cannot be parsed into an int |
|
inline |
Puts a value at an index. This will fill any unset indexes less than index
with null
.
key | the index at which to insert the value |
v | the value to insert |