Interface ScriptOperations


@Deprecated public interface ScriptOperations
Deprecated.
since 2.2. The eval command has been removed without replacement in MongoDB Server 4.2.0.
Script operations on MongoDatabase level. Allows interaction with server side JavaScript functions.
Since:
1.7
Author:
Christoph Strobl, Oliver Gierke
  • Method Details

    • register

      Deprecated.
      Store given ExecutableMongoScript generating a synthetic name so that it can be called by it subsequently.
      Parameters:
      script - must not be null.
      Returns:
      NamedMongoScript with name under which the JavaScript function can be called.
    • register

      Deprecated.
      Registers the given NamedMongoScript in the database.
      Parameters:
      script - the NamedMongoScript to be registered.
      Returns:
    • execute

      @Nullable Object execute(ExecutableMongoScript script, Object... args)
      Deprecated.
      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)
      Deprecated.
      Call the JavaScript by its name.
      Parameters:
      scriptName - must not be null or empty.
      args -
      Returns:
    • exists

      boolean exists(String scriptName)
      Deprecated.
      Checks MongoDatabase 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()
      Deprecated.
      Returns names of JavaScript functions that can be called.
      Returns:
      empty Set if no scripts found.