com.mongodb
Class CommandResult
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<java.lang.String,java.lang.Object>
org.bson.BasicBSONObject
com.mongodb.BasicDBObject
com.mongodb.CommandResult
- All Implemented Interfaces:
- DBObject, java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>, BSONObject
public class CommandResult
- extends BasicDBObject
A simple wrapper for the result of getLastError() calls and other commands
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Method Summary |
java.lang.String |
getErrorMessage()
gets the "errmsg" field which holds the error message |
MongoException |
getException()
utility method to create an exception with the command name |
boolean |
ok()
gets the "ok" field which is the result of the command |
void |
throwOnError()
throws an exception containing the cmd name, in case the command failed, or the "err/code" information |
Methods inherited from class org.bson.BasicBSONObject |
containsField, containsKey, equals, get, getBoolean, getBoolean, getDouble, getInt, getInt, getLong, getString, put, putAll, putAll, removeField, toMap |
Methods inherited from class java.util.LinkedHashMap |
clear, containsValue, get, removeEldestEntry |
Methods inherited from class java.util.HashMap |
clone, containsKey, entrySet, isEmpty, keySet, remove, size, values |
Methods inherited from class java.util.AbstractMap |
hashCode |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
containsKey, entrySet, hashCode, isEmpty, keySet, remove, size, values |
ok
public boolean ok()
- gets the "ok" field which is the result of the command
- Returns:
getErrorMessage
public java.lang.String getErrorMessage()
- gets the "errmsg" field which holds the error message
- Returns:
getException
public MongoException getException()
- utility method to create an exception with the command name
- Returns:
throwOnError
public void throwOnError()
throws MongoException
- throws an exception containing the cmd name, in case the command failed, or the "err/code" information
- Throws:
MongoException