Class MongoDBCollection<T>

  • All Implemented Interfaces:
    step.core.collections.Collection<T>

    public class MongoDBCollection<T>
    extends step.core.collections.filesystem.AbstractCollection<T>
    implements step.core.collections.Collection<T>
    • Constructor Detail

      • MongoDBCollection

        public MongoDBCollection​(MongoClientSession mongoClientSession,
                                 String collectionName,
                                 Class<T> entityClass)
        Parameters:
        collectionName - the name of the mongo collection
        entityClass - the
    • Method Detail

      • count

        public long count​(step.core.collections.Filter filter,
                          Integer limit)
        Specified by:
        count in interface step.core.collections.Collection<T>
      • estimatedCount

        public long estimatedCount()
        Specified by:
        estimatedCount in interface step.core.collections.Collection<T>
      • distinct

        public List<String> distinct​(String columnName,
                                     step.core.collections.Filter filter)
        Specified by:
        distinct in interface step.core.collections.Collection<T>
        Parameters:
        columnName - the name of the column (field)
        Returns:
        the distinct values of the column
      • find

        public Stream<T> find​(step.core.collections.Filter filter,
                              step.core.collections.SearchOrder order,
                              Integer skip,
                              Integer limit,
                              int maxTime)
        Specified by:
        find in interface step.core.collections.Collection<T>
      • findReduced

        public Stream<T> findReduced​(step.core.collections.Filter filter,
                                     step.core.collections.SearchOrder order,
                                     Integer skip,
                                     Integer limit,
                                     int maxTime,
                                     List<String> reduceFields)
        Specified by:
        findReduced in interface step.core.collections.Collection<T>
      • remove

        public void remove​(step.core.collections.Filter filter)
        Specified by:
        remove in interface step.core.collections.Collection<T>
      • save

        public T save​(T entity)
        Specified by:
        save in interface step.core.collections.Collection<T>
      • save

        public void save​(Iterable<T> entities)
        Specified by:
        save in interface step.core.collections.Collection<T>
      • createOrUpdateIndex

        public void createOrUpdateIndex​(String field)
        Specified by:
        createOrUpdateIndex in interface step.core.collections.Collection<T>
      • createOrUpdateIndex

        public void createOrUpdateIndex​(String field,
                                        int order)
        Specified by:
        createOrUpdateIndex in interface step.core.collections.Collection<T>
      • createOrUpdateCompoundIndex

        public void createOrUpdateCompoundIndex​(String... fields)
        Specified by:
        createOrUpdateCompoundIndex in interface step.core.collections.Collection<T>
      • createOrUpdateCompoundIndex

        public void createOrUpdateCompoundIndex​(Map<String,​Integer> fields)
        Specified by:
        createOrUpdateCompoundIndex in interface step.core.collections.Collection<T>
      • createOrUpdateIndex

        public static void createOrUpdateIndex​(com.mongodb.client.MongoCollection<?> collection,
                                               String attribute,
                                               int order)
      • createOrUpdateCompoundIndex

        public static void createOrUpdateCompoundIndex​(com.mongodb.client.MongoCollection<?> collection,
                                                       Map<String,​Integer> fields)
      • rename

        public void rename​(String newName)
        Specified by:
        rename in interface step.core.collections.Collection<T>
      • drop

        public void drop()
        Specified by:
        drop in interface step.core.collections.Collection<T>