Package step.core.collections.mongodb
Class MongoDBCollection<T>
- java.lang.Object
-
- step.core.collections.filesystem.AbstractCollection<T>
-
- step.core.collections.mongodb.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>
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringCSV_DELIMITER
-
Constructor Summary
Constructors Constructor Description MongoDBCollection(MongoClientSession mongoClientSession, String collectionName, Class<T> entityClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longcount(step.core.collections.Filter filter, Integer limit)static voidcreateOrUpdateCompoundIndex(com.mongodb.client.MongoCollection<?> collection, Map<String,Integer> fields)voidcreateOrUpdateCompoundIndex(String... fields)voidcreateOrUpdateCompoundIndex(Map<String,Integer> fields)static voidcreateOrUpdateIndex(com.mongodb.client.MongoCollection<?> collection, String attribute, int order)voidcreateOrUpdateIndex(String field)voidcreateOrUpdateIndex(String field, int order)List<String>distinct(String columnName, step.core.collections.Filter filter)voiddrop()longestimatedCount()Stream<T>find(step.core.collections.Filter filter, step.core.collections.SearchOrder order, Integer skip, Integer limit, int maxTime)Stream<T>findReduced(step.core.collections.Filter filter, step.core.collections.SearchOrder order, Integer skip, Integer limit, int maxTime, List<String> reduceFields)voidremove(step.core.collections.Filter filter)voidrename(String newName)voidsave(Iterable<T> entities)Tsave(T entity)
-
-
-
Field Detail
-
CSV_DELIMITER
protected static final String CSV_DELIMITER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MongoDBCollection
public MongoDBCollection(MongoClientSession mongoClientSession, String collectionName, Class<T> entityClass)
- Parameters:
collectionName- the name of the mongo collectionentityClass- the
-
-
Method Detail
-
count
public long count(step.core.collections.Filter filter, Integer limit)- Specified by:
countin interfacestep.core.collections.Collection<T>
-
estimatedCount
public long estimatedCount()
- Specified by:
estimatedCountin interfacestep.core.collections.Collection<T>
-
distinct
public List<String> distinct(String columnName, step.core.collections.Filter filter)
- Specified by:
distinctin interfacestep.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:
findin interfacestep.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:
findReducedin interfacestep.core.collections.Collection<T>
-
remove
public void remove(step.core.collections.Filter filter)
- Specified by:
removein interfacestep.core.collections.Collection<T>
-
save
public void save(Iterable<T> entities)
- Specified by:
savein interfacestep.core.collections.Collection<T>
-
createOrUpdateIndex
public void createOrUpdateIndex(String field)
- Specified by:
createOrUpdateIndexin interfacestep.core.collections.Collection<T>
-
createOrUpdateIndex
public void createOrUpdateIndex(String field, int order)
- Specified by:
createOrUpdateIndexin interfacestep.core.collections.Collection<T>
-
createOrUpdateCompoundIndex
public void createOrUpdateCompoundIndex(String... fields)
- Specified by:
createOrUpdateCompoundIndexin interfacestep.core.collections.Collection<T>
-
createOrUpdateCompoundIndex
public void createOrUpdateCompoundIndex(Map<String,Integer> fields)
- Specified by:
createOrUpdateCompoundIndexin interfacestep.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:
renamein interfacestep.core.collections.Collection<T>
-
drop
public void drop()
- Specified by:
dropin interfacestep.core.collections.Collection<T>
-
-