com.github.aidensuen.mongo.session.MongoSession Maven / Gradle / Ivy
package com.github.aidensuen.mongo.session;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
public interface MongoSession {
MongoDatabase getDb();
Configuration getConfiguration();
T save(String statement, T objectToSave);
T insert(String statement, T objectToSave);
Collection insert(String statement, Collection extends T> batchToSave);
DeleteResult remove(String statement, Object parameter);
T findOne(String statement, Object parameter);
List find(String statement, Object parameter);
List find(String statement, Object parameter, Pageable pageable);
List find(String statement, Object parameter, Function converter);
List find(String statement, Object parameter, Pageable pageable, Function converter);
Map findMap(String statement, Object parameter, String mapKey);
Map findMap(String statement, Object parameter, String mapKey, Pageable pageable);
long count(String statement, Object parameter);
boolean exists(String statement, Object parameter);
UpdateResult updateFirst(String statement, Object parameter);
UpdateResult updateMulti(String statement, Object parameter);
UpdateResult upsert(String statement, Object parameter);
AggregationResults aggregate(String statement, Object parameter);
T getMongoDao(Class type);
}