org.springframework.data.mongodb.core

Interface ScriptOperations



  • public interface ScriptOperations
    Script operations on DB level. Allows interaction with server side JavaScript functions.
    Since:
    1.7
    Author:
    Christoph Strobl, Oliver Gierke
    • Method Detail

      • execute

        @Nullable
        Object execute(ExecutableMongoScript script,
                                 Object... args)
        Executes the script by either calling it via its name or directly sending it.
        Parameters:
        script - must not be null.
        args - arguments to pass on for script execution.
        Returns:
        the script evaluation result.
        Throws:
        DataAccessException
      • call

        @Nullable
        Object call(String scriptName,
                              Object... args)
        Call the JavaScript by its name.
        Parameters:
        scriptName - must not be null or empty.
        args -
        Returns:
      • exists

        boolean exists(String scriptName)
        Checks DB for existence of ServerSideJavaScript with given name.
        Parameters:
        scriptName - must not be null or empty.
        Returns:
        false if no ServerSideJavaScript with given name exists.
      • getScriptNames

        Set<String> getScriptNames()
        Returns names of JavaScript functions that can be called.
        Returns:
        empty Set if no scripts found.