|
|
|
@ -51,20 +51,19 @@ public class MongoTemplate extends AbstractDocumentStoreTemplate<DB> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void execute(String command) { |
|
|
|
public void execute(String command) { |
|
|
|
CommandResult cr = getConnection().command(command); |
|
|
|
execute((DBObject)JSON.parse(command)); |
|
|
|
String err = cr.getErrorMessage(); |
|
|
|
|
|
|
|
if (err != null) { |
|
|
|
|
|
|
|
throw new InvalidDataAccessApiUsageException("Command execution of " + |
|
|
|
|
|
|
|
command + " failed: " + err); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void execute(DocumentSource<DBObject> command) { |
|
|
|
public void execute(DocumentSource<DBObject> command) { |
|
|
|
CommandResult cr = getConnection().command(command.getDocument()); |
|
|
|
execute(command.getDocument()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void execute(DBObject command) { |
|
|
|
|
|
|
|
CommandResult cr = getConnection().command(command); |
|
|
|
String err = cr.getErrorMessage(); |
|
|
|
String err = cr.getErrorMessage(); |
|
|
|
if (err != null) { |
|
|
|
if (err != null) { |
|
|
|
throw new InvalidDataAccessApiUsageException("Command execution of " + |
|
|
|
throw new InvalidDataAccessApiUsageException("Command execution of " + |
|
|
|
command.getDocument().toString() + " failed: " + err); |
|
|
|
command.toString() + " failed: " + err); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|