public class Doc extends Object
Constructor and Description |
---|
Doc(org.bson.Document obj)
Wraps a result from Mongo DB
|
Modifier and Type | Method and Description |
---|---|
sirius.kernel.commons.Value |
get(Mapping field)
Returns the value of the requested field wrapped as
Value . |
sirius.kernel.commons.Value |
get(String field)
Returns the value of the requested field wrapped as
Value . |
List<Object> |
getList(Mapping field)
Returns the list contained in the given field
|
List<Object> |
getList(String field)
Returns the list contained in the given field
|
org.bson.Document |
getObject(Mapping field)
Returns the object stored for the given field.
|
org.bson.Document |
getObject(String field)
Returns the object stored for the given field.
|
String |
getString(Mapping field)
Returns the string contents of the given field
|
String |
getString(String field)
Returns the string contents of the given field
|
List<String> |
getStringList(Mapping field)
Returns the list of strings contained in the given field
|
List<String> |
getStringList(String field)
Returns the list of strings contained in the given field
|
org.bson.Document |
getUnderlyingObject()
Retruns the underlying Mongo DB Obect.
|
sirius.kernel.commons.Value |
getValueInObject(Mapping field,
String key)
Returns the inner value stored in the object in the given field.
|
sirius.kernel.commons.Value |
getValueInObject(String field,
String key)
Returns the inner value stored in the object in the given field.
|
String |
id()
Returns the ID of the document
|
void |
put(Mapping key,
Object value)
Updates the underlying object, without updating the database.
|
void |
put(String key,
Object value)
Updates the underlying object, without updating the database.
|
String |
toString() |
public Doc(org.bson.Document obj)
obj
- the document or object to wrappublic String id()
public sirius.kernel.commons.Value get(String field)
Value
.field
- the field to fetchpublic sirius.kernel.commons.Value get(Mapping field)
Value
.field
- the field to fetch@Nonnull public String getString(String field)
field
- the field to fetch@Nonnull public String getString(Mapping field)
field
- the field to fetchpublic List<Object> getList(String field)
field
- the field to fetchpublic List<Object> getList(Mapping field)
field
- the field to fetchpublic List<String> getStringList(String field)
field
- the field to fetchpublic List<String> getStringList(Mapping field)
field
- the field to fetchpublic org.bson.Document getObject(String field)
If there is no object present or the given field doesn't contain an object, an empty readonly instance is returned.
field
- the field to readpublic org.bson.Document getObject(Mapping field)
If there is no object present or the given field doesn't contain an object, an empty readonly instance is returned.
field
- the field to readpublic sirius.kernel.commons.Value getValueInObject(String field, String key)
field
- the field to read the object fromkey
- the key to read from the objectValue
public sirius.kernel.commons.Value getValueInObject(Mapping field, String key)
field
- the field to read the object fromkey
- the key to read from the objectValue
public void put(String key, Object value)
This can be used to enhance an existing object after an update for further consumers. This is not intended to
update or modify the database in any way. Use Mongo.update()
instead.
key
- the field to updatevalue
- the new value for the fieldpublic void put(Mapping key, Object value)
This can be used to enhance an existing object after an update for further consumers. This is not intended to
update or modify the database in any way. Use Mongo.update()
instead.
key
- the field to updatevalue
- the new value for the fieldpublic org.bson.Document getUnderlyingObject()
Copyright © 2018. All rights reserved.