Executing Commands
You can get at the MongoDB driver’s MongoDatabase.runCommand( ) method by using the executeCommand(…) methods on MongoTemplate. These methods also perform exception translation into Spring’s DataAccessException hierarchy.
Methods for executing commands
-
DocumentexecuteCommand(Document command): Run a MongoDB command. -
DocumentexecuteCommand(Document command, ReadPreference readPreference): Run a MongoDB command with the given nullable MongoDBReadPreference. -
DocumentexecuteCommand(String jsonCommand): Execute a MongoDB command expressed as a JSON string.