下面列出了怎么用com.mongodb.reactivestreams.client.ClientSession的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public <T> Multi<ChangeStreamDocument<T>> watch(ClientSession clientSession, List<? extends Bson> pipeline,
Class<T> clazz, ChangeStreamOptions options) {
return null;
}
@Override
public Uni<Void> createCollection(ClientSession clientSession, String collectionName,
CreateCollectionOptions options) {
return Wrappers.toUni(database.createCollection(clientSession, collectionName, options));
}
@Override
public <D> Multi<ChangeStreamDocument<D>> watch(ClientSession clientSession, Class<D> clazz,
ChangeStreamOptions options) {
return Wrappers.toMulti(apply(options, collection.watch(clientSession, clazz)));
}
@Override
public <T> Multi<ChangeStreamDocument<T>> watch(ClientSession clientSession, Class<T> clazz,
ChangeStreamOptions options) {
return null;
}
@Override
public Uni<BulkWriteResult> bulkWrite(ClientSession clientSession,
List<? extends WriteModel<? extends T>> requests, BulkWriteOptions options) {
return Wrappers.toUni(collection.bulkWrite(clientSession, requests, options));
}
@Override
public Multi<T> mapReduce(ClientSession clientSession, String mapFunction, String reduceFunction) {
return Wrappers.toMulti(collection.mapReduce(clientSession, mapFunction, reduceFunction));
}
@Override
public <T> Multi<ChangeStreamDocument<T>> watch(ClientSession clientSession, Class<T> clazz) {
return Wrappers.toMulti(database.watch(clientSession, clazz));
}
@Override
public Multi<Document> listCollections(ClientSession clientSession) {
return Wrappers.toMulti(database.listCollections(clientSession));
}
@Override
public Multi<T> find(ClientSession clientSession, Bson filter, FindOptions options) {
return Wrappers.toMulti(apply(options, collection.find(clientSession, filter)));
}
@Override
public Multi<Document> aggregate(ClientSession clientSession, List<? extends Bson> pipeline,
AggregateOptions options) {
return Wrappers.toMulti(apply(options, database.aggregate(clientSession, pipeline)));
}
@Override
public <D> Multi<ChangeStreamDocument<D>> watch(ClientSession clientSession, Class<D> clazz) {
return Wrappers.toMulti(collection.watch(clientSession, clazz));
}
@Override
public Multi<ChangeStreamDocument<Document>> watch(ClientSession clientSession,
List<? extends Bson> pipeline) {
return Wrappers.toMulti(client.watch(clientSession, pipeline));
}
@Override
public <T> Multi<T> listCollections(ClientSession clientSession, Class<T> clazz, CollectionListOptions options) {
return Multi.createFrom().publisher(apply(options, database.listCollections(clientSession, clazz)));
}
@Override
public Uni<DeleteResult> deleteMany(ClientSession clientSession, Bson filter, DeleteOptions options) {
return Wrappers.toUni(collection.deleteMany(clientSession, filter, options));
}
@Override
public <D> Multi<D> distinct(ClientSession clientSession, String fieldName, Class<D> clazz,
DistinctOptions options) {
return Wrappers.toMulti(apply(options, collection.distinct(clientSession, fieldName, clazz)));
}
@Override
public Uni<Long> countDocuments(ClientSession clientSession) {
return Wrappers.toUni(collection.countDocuments(clientSession));
}
@Override
public Multi<T> aggregate(ClientSession clientSession, List<? extends Bson> pipeline) {
return Wrappers.toMulti(collection.aggregate(clientSession, pipeline));
}
@Override
public Multi<Document> listDatabases(ClientSession clientSession) {
return Wrappers.toMulti(client.listDatabases(clientSession));
}
@Override
public Uni<Void> dropIndex(ClientSession clientSession, Bson keys) {
return Wrappers.toUni(collection.dropIndex(clientSession, keys));
}
@Override
public <T> Uni<T> runCommand(ClientSession clientSession, Bson command, Class<T> clazz) {
return Wrappers.toUni(database.runCommand(clientSession, command, clazz));
}
@Override
public Uni<DeleteResult> deleteOne(ClientSession clientSession, Bson filter) {
return Wrappers.toUni(collection.deleteOne(clientSession, filter));
}
@Override
public Uni<DeleteResult> deleteOne(ClientSession clientSession, Bson filter, DeleteOptions options) {
return Wrappers.toUni(collection.deleteOne(clientSession, filter, options));
}
@Override
public <T> Multi<ChangeStreamDocument<T>> watch(ClientSession clientSession, List<? extends Bson> pipeline,
Class<T> clazz, ChangeStreamOptions options) {
ChangeStreamPublisher<T> publisher = apply(options, client.watch(clientSession, pipeline, clazz));
return Wrappers.toMulti(publisher);
}
@Override
public Uni<List<String>> createIndexes(ClientSession clientSession, List<IndexModel> indexes,
CreateIndexOptions createIndexOptions) {
return Wrappers.toUniOfList(collection.createIndexes(clientSession, indexes, createIndexOptions));
}
@Override
public Uni<BulkWriteResult> bulkWrite(ClientSession clientSession,
List<? extends WriteModel<? extends T>> requests) {
return Wrappers.toUni(collection.bulkWrite(clientSession, requests));
}
@Override
public Multi<T> find(ClientSession clientSession) {
return Wrappers.toMulti(collection.find(clientSession));
}
@Override
public Uni<ClientSession> startSession() {
return Wrappers.toUni(client.startSession());
}
@Override
public Uni<T> findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update,
FindOneAndUpdateOptions options) {
return Wrappers.toUni(collection.findOneAndUpdate(clientSession, filter, update, options));
}
@Override
public Uni<Long> countDocuments(ClientSession clientSession, Bson filter) {
return Wrappers.toUni(collection.countDocuments(clientSession, filter));
}
@Override
public Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, Bson update,
UpdateOptions options) {
return Wrappers.toUni(collection.updateOne(clientSession, filter, update, options));
}