Class UnionWith

java.lang.Object
dev.morphia.aggregation.stages.Stage
dev.morphia.aggregation.stages.UnionWith

public class UnionWith extends Stage
Performs a union of two collections; i.e. $unionWith combines pipeline results from two collections into a single result set. The stage outputs the combined result set (including duplicates) to the next stage.
Since:
2.1
  • Method Details

    • unionWith

      public static Stage unionWith(Stage... stages)
      Performs a union of two collections; i.e. $unionWith combines pipeline results from two collections into a single result set. The stage outputs the combined result set (including duplicates) to the next stage.
      Parameters:
      stages - the pipeline stages
      Returns:
      the new Stage
      Since:
      3.0
      MongoDB documentation
      Aggregration Pipeline Stage: $unionWith
      Since server release
      4.4
    • unionWith

      public static Stage unionWith(Class<?> type, Stage... stages)
      Performs a union of two collections; i.e. $unionWith combines pipeline results from two collections into a single result set. The stage outputs the combined result set (including duplicates) to the next stage.
      Parameters:
      type - the type to perform the pipeline against
      stages - the pipeline stages
      Returns:
      the new Stage
      MongoDB documentation
      Aggregration Pipeline Stage: $unionWith
      Since server release
      4.4
    • unionWith

      public static Stage unionWith(String collection, Stage... stages)
      Performs a union of two collections; i.e. $unionWith combines pipeline results from two collections into a single result set. The stage outputs the combined result set (including duplicates) to the next stage.
      Parameters:
      collection - the collection to perform the pipeline against
      stages - the pipeline stages
      Returns:
      the new stage
      MongoDB documentation
      Aggregration Pipeline Stage: $unionWith
      Since server release
      4.4