DBObject, Serializable, Cloneable, Map<String,Object>, BSONObject, Bsonpublic class CommandResult extends BasicDBObject
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>| Modifier and Type | Method | Description |
|---|---|---|
String |
getErrorMessage() |
Gets the error message associated with a failed command.
|
MongoException |
getException() |
Utility method to create an exception from a failed command.
|
boolean |
ok() |
Gets the "ok" field, which is whether this command executed correctly or not.
|
void |
throwOnError() |
Throws a
CommandFailureException if the command failed. |
containsField, containsKey, get, getBoolean, getBoolean, getDate, getDate, getDouble, getDouble, getInt, getInt, getLong, getLong, getObjectId, getObjectId, getString, getString, putAll, putAll, removeField, toMapappend, copy, equals, hashCode, isPartialObject, markAsPartialObject, parse, parse, toBsonDocument, toJson, toJson, toJson, toJson, toStringcontainsField, containsKey, get, keySet, put, putAll, putAll, removeField, toMapclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putIfAbsent, remove, remove, replace, replace, sizeclear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuespublic boolean ok()
@Nullable public String getErrorMessage()
@Nullable public MongoException getException()
public void throwOnError()
CommandFailureException if the command failed. Otherwise, returns normally.MongoException - with the exception from the failed commandok()