diff --git a/bom/deployment/pom.xml b/bom/deployment/pom.xml
index 47068b79db48a..76857810fb886 100644
--- a/bom/deployment/pom.xml
+++ b/bom/deployment/pom.xml
@@ -321,6 +321,11 @@
quarkus-panache-common-deployment
${project.version}
+
+ io.quarkus
+ quarkus-mongodb-panache-deployment
+ ${project.version}
+
io.quarkus
quarkus-mongodb-client-deployment
diff --git a/docs/src/main/asciidoc/mongodb-panache.adoc b/docs/src/main/asciidoc/mongodb-panache.adoc
index 26853836ae261..d3ce189cfba72 100644
--- a/docs/src/main/asciidoc/mongodb-panache.adoc
+++ b/docs/src/main/asciidoc/mongodb-panache.adoc
@@ -530,6 +530,109 @@ you need to provide the value by yourself.
`ObjectId` can be difficult to use if you want to expose its value in your REST service.
So we created JSON-B and Jackson providers to serialize/deserialize them as a `String` which are are automatically registered if your project depends on one of the RESTEasy with JSON-B or RESTEasy with Jackson extensions.
+== Reactive Entities and Repositories
+
+MongoDB with Panache allows using reactive style implementation for both entities and repositories.
+For this, you need to use the Reactive variants when defining your entities : `ReactivePanacheMongoEntity` or `ReactivePanacheMongoEntityBase`,
+and when defining your repositories: `ReactivePanacheMongoRepository` or `ReactivePanacheMongoRepositoryBase`.
+
+The reactive variant of the `Person` class will be:
+
+[source,java]
+----
+public class ReactivePerson extends ReactivePanacheMongoEntity {
+ public String name;
+ public LocalDate birth;
+ public Status status;
+
+ // return name as uppercase in the model
+ public String getName(){
+ return name.toUpperCase();
+ }
+
+ // store all names in lowercase in the DB
+ public void setName(String name){
+ this.name = name.toLowerCase();
+ }
+}
+----
+
+You will have access to the same functionalities of the _imperative_ variant inside the reactive one: bson annotations, custom ID, PanacheQL, ...
+But the methods on your entities or repositories will all return reactive types.
+
+See the equivalent methods from the imperative example with the reactive variant:
+
+[source,java]
+----
+// creating a person
+ReactivePerson person = new ReactivePerson();
+person.name = "Loïc";
+person.birth = LocalDate.of(1910, Month.FEBRUARY, 1);
+person.status = Status.Alive;
+
+// persist it
+CompletionStage cs1 = person.persist();
+
+person.status = Status.Dead;
+
+// Your must call update() in order to send your entity modifications to MongoDB
+CompletionStage cs2 = person.update();
+
+// delete it
+CompletionStage cs3 = person.delete();
+
+// getting a list of all persons
+CompletionStage> allPersons = ReactivePerson.listAll();
+
+// finding a specific person by ID
+CompletionStage personById = ReactivePerson.findById(personId);
+
+// finding a specific person by ID via an Optional
+CompletionStage> optional = ReactivePerson.findByIdOptional(personId);
+personById = optional.thenApply(o -> o.orElseThrow(() -> new NotFoundException()));
+
+// finding all living persons
+CompletionStage> livingPersons = ReactivePerson.list("status", Status.Alive);
+
+// counting all persons
+CompletionStage countAll = ReactivePerson.count();
+
+// counting all living persons
+CompletionStage countAlive = ReactivePerson.count("status", Status.Alive);
+
+// delete all living persons
+CompletionStage deleteCount = ReactivePerson.delete("status", Status.Alive);
+
+// delete all persons
+deleteCount = ReactivePerson.deleteAll();
+----
+
+TIP: If you use MongoDB with Panache in conjunction with Resteasy, you can directly return a reactive type inside your JAX-RS resource endpoint as Resteasy will handle it correctly.
+
+The same query facility exist for the reactive types, but the `stream()` methods acts differently: it returns a reactive stream `Publisher` instead of a `Stream`.
+
+It allows more advanced reactive use case, for example you can use it to send server-sent events (SSE) via Resteasy:
+
+[source,java]
+----
+import org.jboss.resteasy.annotations.SseElementType;
+import org.reactivestreams.Publisher;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@GET
+@Path("/stream")
+@Produces(MediaType.SERVER_SENT_EVENTS)
+@SseElementType(MediaType.APPLICATION_JSON)
+public Publisher streamPersons() {
+ return ReactivePerson.streamAll();
+}
+----
+
+TIP: `@SseElementType(MediaType.APPLICATION_JSON)` tells Resteasy to serialize the object in JSON.
+
+
== How and why we simplify MongoDB API
When it comes to writing MongoDB entities, there are a number of annoying things that users have grown used to
diff --git a/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheMongoEntityEnhancer.java b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheMongoEntityEnhancer.java
index 27d5b0c216769..0ae97ab3399c2 100644
--- a/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheMongoEntityEnhancer.java
+++ b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheMongoEntityEnhancer.java
@@ -69,11 +69,6 @@ protected void generateAccessorSetField(MethodVisitor mv, EntityField field) {
protected void generateAccessorGetField(MethodVisitor mv, EntityField field) {
mv.visitFieldInsn(Opcodes.GETFIELD, thisClass.getInternalName(), field.name, field.descriptor);
}
-
- @Override
- public void visitEnd() {
- super.visitEnd();
- }
}
public void collectFields(ClassInfo classInfo) {
diff --git a/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheResourceProcessor.java b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheResourceProcessor.java
index 955447d874ead..442cafb4bbab8 100644
--- a/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheResourceProcessor.java
+++ b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/PanacheResourceProcessor.java
@@ -43,10 +43,15 @@
import io.quarkus.mongodb.panache.PanacheMongoRepository;
import io.quarkus.mongodb.panache.PanacheMongoRepositoryBase;
import io.quarkus.mongodb.panache.ProjectionFor;
+import io.quarkus.mongodb.panache.axle.ReactivePanacheMongoEntity;
+import io.quarkus.mongodb.panache.axle.ReactivePanacheMongoEntityBase;
+import io.quarkus.mongodb.panache.axle.ReactivePanacheMongoRepository;
+import io.quarkus.mongodb.panache.axle.ReactivePanacheMongoRepositoryBase;
import io.quarkus.panache.common.deployment.PanacheFieldAccessEnhancer;
import io.quarkus.panache.common.deployment.PanacheRepositoryEnhancer;
public class PanacheResourceProcessor {
+ // blocking types
static final DotName DOTNAME_PANACHE_REPOSITORY_BASE = DotName.createSimple(PanacheMongoRepositoryBase.class.getName());
private static final DotName DOTNAME_PANACHE_REPOSITORY = DotName.createSimple(PanacheMongoRepository.class.getName());
static final DotName DOTNAME_PANACHE_ENTITY_BASE = DotName.createSimple(PanacheMongoEntityBase.class.getName());
@@ -55,6 +60,15 @@ public class PanacheResourceProcessor {
private static final DotName DOTNAME_PROJECTION_FOR = DotName.createSimple(ProjectionFor.class.getName());
private static final DotName DOTNAME_BSON_PROPERTY = DotName.createSimple(BsonProperty.class.getName());
+ // reactive types: Axle
+ static final DotName DOTNAME_AXLE_PANACHE_REPOSITORY_BASE = DotName
+ .createSimple(ReactivePanacheMongoRepositoryBase.class.getName());
+ private static final DotName DOTNAME_AXLE_PANACHE_REPOSITORY = DotName
+ .createSimple(ReactivePanacheMongoRepository.class.getName());
+ static final DotName DOTNAME_AXLE_PANACHE_ENTITY_BASE = DotName
+ .createSimple(ReactivePanacheMongoEntityBase.class.getName());
+ private static final DotName DOTNAME_AXLE_PANACHE_ENTITY = DotName.createSimple(ReactivePanacheMongoEntity.class.getName());
+
private static final DotName DOTNAME_OBJECT_ID = DotName.createSimple(ObjectId.class.getName());
private static final DotName DOTNAME_OBJECT = DotName.createSimple(Object.class.getName());
@@ -265,4 +279,58 @@ private void extractMappings(Map classPropertyMapping, ClassInfo
extractMappings(classPropertyMapping, superClass, index);
}
}
+
+ @BuildStep
+ void buildAxle(CombinedIndexBuildItem index,
+ ApplicationIndexBuildItem applicationIndex,
+ BuildProducer transformers) throws Exception {
+
+ ReactivePanacheMongoRepositoryEnhancer daoEnhancer = new ReactivePanacheMongoRepositoryEnhancer(index.getIndex());
+ Set daoClasses = new HashSet<>();
+ for (ClassInfo classInfo : index.getIndex().getAllKnownImplementors(DOTNAME_AXLE_PANACHE_REPOSITORY_BASE)) {
+ // Skip PanacheRepository
+ if (classInfo.name().equals(DOTNAME_AXLE_PANACHE_REPOSITORY))
+ continue;
+ if (PanacheRepositoryEnhancer.skipRepository(classInfo))
+ continue;
+ daoClasses.add(classInfo.name().toString());
+ }
+ for (ClassInfo classInfo : index.getIndex().getAllKnownImplementors(DOTNAME_AXLE_PANACHE_REPOSITORY)) {
+ if (PanacheRepositoryEnhancer.skipRepository(classInfo))
+ continue;
+ daoClasses.add(classInfo.name().toString());
+ }
+ for (String daoClass : daoClasses) {
+ transformers.produce(new BytecodeTransformerBuildItem(daoClass, daoEnhancer));
+ }
+
+ ReactivePanacheMongoEntityEnhancer modelEnhancer = new ReactivePanacheMongoEntityEnhancer(index.getIndex());
+ Set modelClasses = new HashSet<>();
+ // Note that we do this in two passes because for some reason Jandex does not give us subtypes
+ // of PanacheMongoEntity if we ask for subtypes of PanacheMongoEntityBase
+ for (ClassInfo classInfo : index.getIndex().getAllKnownSubclasses(DOTNAME_AXLE_PANACHE_ENTITY_BASE)) {
+ if (classInfo.name().equals(DOTNAME_AXLE_PANACHE_ENTITY))
+ continue;
+ if (modelClasses.add(classInfo.name().toString()))
+ modelEnhancer.collectFields(classInfo);
+ }
+ for (ClassInfo classInfo : index.getIndex().getAllKnownSubclasses(DOTNAME_AXLE_PANACHE_ENTITY)) {
+ if (modelClasses.add(classInfo.name().toString()))
+ modelEnhancer.collectFields(classInfo);
+ }
+ for (String modelClass : modelClasses) {
+ transformers.produce(new BytecodeTransformerBuildItem(modelClass, modelEnhancer));
+ }
+
+ if (!modelEnhancer.entities.isEmpty()) {
+ PanacheFieldAccessEnhancer panacheFieldAccessEnhancer = new PanacheFieldAccessEnhancer(
+ modelEnhancer.getModelInfo());
+ for (ClassInfo classInfo : applicationIndex.getIndex().getKnownClasses()) {
+ String className = classInfo.name().toString();
+ if (!modelClasses.contains(className)) {
+ transformers.produce(new BytecodeTransformerBuildItem(className, panacheFieldAccessEnhancer));
+ }
+ }
+ }
+ }
}
diff --git a/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/ReactivePanacheMongoEntityEnhancer.java b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/ReactivePanacheMongoEntityEnhancer.java
new file mode 100644
index 0000000000000..b425ded06c775
--- /dev/null
+++ b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/ReactivePanacheMongoEntityEnhancer.java
@@ -0,0 +1,84 @@
+package io.quarkus.mongodb.panache.deployment;
+
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.bson.codecs.pojo.annotations.BsonIgnore;
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.FieldInfo;
+import org.jboss.jandex.IndexView;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+import io.quarkus.gizmo.DescriptorUtils;
+import io.quarkus.mongodb.panache.axle.runtime.ReactiveMongoOperations;
+import io.quarkus.panache.common.deployment.EntityField;
+import io.quarkus.panache.common.deployment.EntityModel;
+import io.quarkus.panache.common.deployment.MetamodelInfo;
+import io.quarkus.panache.common.deployment.PanacheEntityEnhancer;
+
+public class ReactivePanacheMongoEntityEnhancer extends PanacheEntityEnhancer>> {
+ public final static String MONGO_OPERATIONS_NAME = ReactiveMongoOperations.class.getName();
+ public final static String MONGO_OPERATIONS_BINARY_NAME = MONGO_OPERATIONS_NAME.replace('.', '/');
+
+ private static final DotName DOTNAME_BSON_IGNORE = DotName.createSimple(BsonIgnore.class.getName());
+
+ final Map entities = new HashMap<>();
+
+ public ReactivePanacheMongoEntityEnhancer(IndexView index) {
+ super(index, PanacheResourceProcessor.DOTNAME_AXLE_PANACHE_ENTITY_BASE);
+ modelInfo = new MetamodelInfo<>();
+ }
+
+ @Override
+ public ClassVisitor apply(String className, ClassVisitor outputClassVisitor) {
+ return new PanacheMongoEntityClassVisitor(className, outputClassVisitor, modelInfo, panacheEntityBaseClassInfo);
+ }
+
+ static class PanacheMongoEntityClassVisitor extends PanacheEntityClassVisitor {
+
+ public PanacheMongoEntityClassVisitor(String className, ClassVisitor outputClassVisitor,
+ MetamodelInfo> modelInfo, ClassInfo panacheEntityBaseClassInfo) {
+ super(className, outputClassVisitor, modelInfo, panacheEntityBaseClassInfo);
+ }
+
+ @Override
+ protected void injectModel(MethodVisitor mv) {
+ mv.visitLdcInsn(thisClass);
+ }
+
+ @Override
+ protected String getModelDescriptor() {
+ return "Ljava/lang/Class;";
+ }
+
+ @Override
+ protected String getPanacheOperationsBinaryName() {
+ return MONGO_OPERATIONS_BINARY_NAME;
+ }
+
+ @Override
+ protected void generateAccessorSetField(MethodVisitor mv, EntityField field) {
+ mv.visitFieldInsn(Opcodes.PUTFIELD, thisClass.getInternalName(), field.name, field.descriptor);
+ }
+
+ @Override
+ protected void generateAccessorGetField(MethodVisitor mv, EntityField field) {
+ mv.visitFieldInsn(Opcodes.GETFIELD, thisClass.getInternalName(), field.name, field.descriptor);
+ }
+ }
+
+ public void collectFields(ClassInfo classInfo) {
+ EntityModel entityModel = new EntityModel<>(classInfo);
+ for (FieldInfo fieldInfo : classInfo.fields()) {
+ String name = fieldInfo.name();
+ if (Modifier.isPublic(fieldInfo.flags()) && !fieldInfo.hasAnnotation(DOTNAME_BSON_IGNORE)) {
+ entityModel.addField(new EntityField(name, DescriptorUtils.typeToString(fieldInfo.type())));
+ }
+ }
+ modelInfo.addEntityModel(entityModel);
+ }
+}
diff --git a/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/ReactivePanacheMongoRepositoryEnhancer.java b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/ReactivePanacheMongoRepositoryEnhancer.java
new file mode 100644
index 0000000000000..b26938f15d55c
--- /dev/null
+++ b/extensions/panache/mongodb-panache/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/ReactivePanacheMongoRepositoryEnhancer.java
@@ -0,0 +1,62 @@
+package io.quarkus.mongodb.panache.deployment;
+
+import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.MethodVisitor;
+
+import io.quarkus.mongodb.panache.axle.ReactivePanacheMongoRepository;
+import io.quarkus.mongodb.panache.axle.ReactivePanacheMongoRepositoryBase;
+import io.quarkus.panache.common.deployment.PanacheRepositoryEnhancer;
+
+public class ReactivePanacheMongoRepositoryEnhancer extends PanacheRepositoryEnhancer {
+ public final static DotName PANACHE_REPOSITORY_BASE_NAME = DotName
+ .createSimple(ReactivePanacheMongoRepositoryBase.class.getName());
+
+ public final static DotName PANACHE_REPOSITORY_NAME = DotName.createSimple(ReactivePanacheMongoRepository.class.getName());
+
+ public ReactivePanacheMongoRepositoryEnhancer(IndexView index) {
+ super(index, PanacheResourceProcessor.DOTNAME_AXLE_PANACHE_REPOSITORY_BASE);
+ }
+
+ @Override
+ public ClassVisitor apply(String className, ClassVisitor outputClassVisitor) {
+ return new PanacheMongoRepositoryClassVisitor(className, outputClassVisitor, panacheRepositoryBaseClassInfo,
+ this.indexView);
+ }
+
+ static class PanacheMongoRepositoryClassVisitor extends PanacheRepositoryClassVisitor {
+
+ public PanacheMongoRepositoryClassVisitor(String className, ClassVisitor outputClassVisitor,
+ ClassInfo panacheRepositoryBaseClassInfo, IndexView indexView) {
+ super(className, outputClassVisitor, panacheRepositoryBaseClassInfo, indexView);
+ }
+
+ @Override
+ protected DotName getPanacheRepositoryDotName() {
+ return PANACHE_REPOSITORY_NAME;
+ }
+
+ @Override
+ protected DotName getPanacheRepositoryBaseDotName() {
+ return PANACHE_REPOSITORY_BASE_NAME;
+ }
+
+ @Override
+ protected String getPanacheOperationsBinaryName() {
+ return ReactivePanacheMongoEntityEnhancer.MONGO_OPERATIONS_BINARY_NAME;
+ }
+
+ @Override
+ protected void injectModel(MethodVisitor mv) {
+ // inject Class
+ mv.visitLdcInsn(entityType);
+ }
+
+ @Override
+ protected String getModelDescriptor() {
+ return "Ljava/lang/Class;";
+ }
+ }
+}
diff --git a/extensions/panache/mongodb-panache/runtime/pom.xml b/extensions/panache/mongodb-panache/runtime/pom.xml
index 1efc566d6e9e8..1a6f1d7b7451f 100644
--- a/extensions/panache/mongodb-panache/runtime/pom.xml
+++ b/extensions/panache/mongodb-panache/runtime/pom.xml
@@ -24,11 +24,11 @@
io.quarkus
- quarkus-panacheql
+ quarkus-mongodb-client
io.quarkus
- quarkus-mongodb-client
+ quarkus-panacheql
@@ -74,19 +74,6 @@
-
-
-
- ${project.build.directory}/classes
-
-
- **/PanacheMongoJsonbContextResolver.class
-
- **/ObjectMapperProducer.class
-
-
-
-
diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/MongoEntity.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/MongoEntity.java
old mode 100755
new mode 100644
diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoEntity.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoEntity.java
new file mode 100644
index 0000000000000..6218b3ba67b7a
--- /dev/null
+++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoEntity.java
@@ -0,0 +1,30 @@
+package io.quarkus.mongodb.panache.axle;
+
+import org.bson.types.ObjectId;
+
+/**
+ * Represents an entity with a generated ID field {@link #id} of type {@link ObjectId}. If your
+ * Mongo entities extend this class they gain the ID field and auto-generated accessors
+ * to all their public fields, as well as all the useful methods from {@link ReactivePanacheMongoEntityBase}.
+ *
+ * If you want a custom ID type or strategy, you can directly extend {@link ReactivePanacheMongoEntityBase}
+ * instead, and write your own ID field. You will still get auto-generated accessors and
+ * all the useful methods.
+ *
+ * @see ReactivePanacheMongoEntityBase
+ */
+public abstract class ReactivePanacheMongoEntity extends ReactivePanacheMongoEntityBase {
+
+ /**
+ * The auto-generated ID field.
+ * This field is set by Mongo when this entity is persisted.
+ *
+ * @see #persist()
+ */
+ public ObjectId id;
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName() + "<" + id + ">";
+ }
+}
diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoEntityBase.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoEntityBase.java
new file mode 100644
index 0000000000000..59367d60f8287
--- /dev/null
+++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoEntityBase.java
@@ -0,0 +1,892 @@
+package io.quarkus.mongodb.panache.axle;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.CompletionStage;
+import java.util.stream.Stream;
+
+import org.bson.Document;
+import org.reactivestreams.Publisher;
+
+import io.quarkus.mongodb.ReactiveMongoCollection;
+import io.quarkus.mongodb.ReactiveMongoDatabase;
+import io.quarkus.mongodb.panache.axle.runtime.ReactiveMongoOperations;
+import io.quarkus.panache.common.Parameters;
+import io.quarkus.panache.common.Sort;
+import io.quarkus.panache.common.impl.GenerateBridge;
+
+/**
+ * Represents an entity. If your Mongo entities extend this class they gain auto-generated accessors
+ * to all their public fields, as well as a lot of useful
+ * methods. Unless you have a custom ID strategy, you should not extend this class directly but extend
+ * {@link ReactivePanacheMongoEntity} instead.
+ *
+ * @see ReactivePanacheMongoEntity
+ */
+public abstract class ReactivePanacheMongoEntityBase {
+
+ // Operations
+
+ /**
+ * Persist this entity in the database.
+ * This will set it's ID field if not already set.
+ *
+ * @see #persist(Iterable)
+ * @see #persist(Stream)
+ * @see #persist(Object, Object...)
+ */
+ public CompletionStage persist() {
+ return ReactiveMongoOperations.persist(this);
+ }
+
+ /**
+ * Update this entity in the database.
+ *
+ * @see #update(Iterable)
+ * @see #update(Stream)
+ * @see #update(Object, Object...)
+ */
+ public CompletionStage update() {
+ return ReactiveMongoOperations.update(this);
+ }
+
+ /**
+ * Persist this entity in the database or update it if it already exist.
+ *
+ * @see #persistOrUpdate(Iterable)
+ * @see #persistOrUpdate(Stream)
+ * @see #persistOrUpdate(Object, Object...)
+ */
+ public CompletionStage persistOrUpdate() {
+ return ReactiveMongoOperations.persistOrUpdate(this);
+ }
+
+ /**
+ * Delete this entity from the database, if it is already persisted.
+ *
+ * @see #delete(String, Object...)
+ * @see #delete(String, Map)
+ * @see #delete(String, Parameters)
+ * @see #deleteAll()
+ */
+ public CompletionStage delete() {
+ return ReactiveMongoOperations.delete(this);
+ }
+
+ // Queries
+
+ /**
+ * Find an entity of this type by ID.
+ *
+ * @param id the ID of the entity to find.
+ * @return the entity found, or null
if not found.
+ */
+ @GenerateBridge
+ public static CompletionStage findById(Object id) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find an entity of this type by ID.
+ *
+ * @param id the ID of the entity to find.
+ * @return if found, an optional containing the entity, else Optional.empty()
.
+ */
+ @GenerateBridge
+ public static CompletionStage> findByIdOptional(Object id) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Sort, Object...)
+ * @see #find(String, Map)
+ * @see #find(String, Parameters)
+ * @see #list(String, Object...)
+ * @see #stream(String, Object...)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query and the given sort options, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params optional sequence of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Object...)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Object...)
+ * @see #stream(String, Sort, Object...)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(String query, Sort sort,
+ Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Object...)
+ * @see #find(String, Parameters)
+ * @see #list(String, Map)
+ * @see #stream(String, Map)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(String query,
+ Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query and the given sort options, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Map} of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Map)
+ * @see #find(String, Sort, Object...)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Map)
+ * @see #stream(String, Sort, Map)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(String query, Sort sort,
+ Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Sort, Parameters)
+ * @see #find(String, Map)
+ * @see #find(String, Parameters)
+ * @see #list(String, Parameters)
+ * @see #stream(String, Parameters)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query and the given sort options, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Parameters} of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(String query, Sort sort,
+ Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a BSON query.
+ *
+ * @param query a {@link Document} query
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a a BSON query and a BSON sort.
+ *
+ * @param query a {@link Document} query
+ * @param sort the {@link Document} sort
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery find(Document query, Document sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type.
+ *
+ * @return a new {@link ReactivePanacheQuery} instance to find all entities of this type.
+ * @see #findAll(Sort)
+ * @see #listAll()
+ * @see #streamAll()
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery findAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type, in the given order.
+ *
+ * @param sort the sort order to use
+ * @return a new {@link ReactivePanacheQuery} instance to find all entities of this type.
+ * @see #findAll()
+ * @see #listAll(Sort)
+ * @see #streamAll(Sort)
+ */
+ @GenerateBridge
+ public static ReactivePanacheQuery findAll(Sort sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with optional indexed parameters.
+ * This method is a shortcut for find(query, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Sort, Object...)
+ * @see #list(String, Map)
+ * @see #list(String, Parameters)
+ * @see #find(String, Object...)
+ * @see #stream(String, Object...)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with optional indexed parameters.
+ * This method is a shortcut for find(query, sort, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params optional sequence of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Object...)
+ * @see #list(String, Sort, Map)
+ * @see #list(String, Sort, Parameters)
+ * @see #find(String, Sort, Object...)
+ * @see #stream(String, Sort, Object...)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(String query, Sort sort,
+ Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Sort, Map)
+ * @see #list(String, Object...)
+ * @see #list(String, Parameters)
+ * @see #find(String, Map)
+ * @see #stream(String, Map)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(String query,
+ Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Map} of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Map)
+ * @see #list(String, Sort, Object...)
+ * @see #list(String, Sort, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #stream(String, Sort, Map)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(String query, Sort sort,
+ Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Sort, Parameters)
+ * @see #list(String, Object...)
+ * @see #list(String, Map)
+ * @see #find(String, Parameters)
+ * @see #stream(String, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Parameters} of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Parameters)
+ * @see #list(String, Sort, Object...)
+ * @see #list(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(String query, Sort sort,
+ Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a BSON query.
+ * This method is a shortcut for find(query).list()
.
+ *
+ * @param query a {@link Document} query
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a a BSON query and a BSON sort.
+ * This method is a shortcut for find(query, sort).list()
.
+ *
+ * @param query a {@link Document} query
+ * @param sort the {@link Document} sort
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage> list(Document query, Document sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type.
+ * This method is a shortcut for findAll().list()
.
+ *
+ * @return a {@link List} containing all results, without paging
+ * @see #listAll(Sort)
+ * @see #findAll()
+ * @see #streamAll()
+ */
+ @GenerateBridge
+ public static CompletionStage> listAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type, in the given order.
+ * This method is a shortcut for findAll(sort).list()
.
+ *
+ * @param sort the sort order to use
+ * @return a {@link List} containing all results, without paging
+ * @see #listAll()
+ * @see #findAll(Sort)
+ * @see #streamAll(Sort)
+ */
+ @GenerateBridge
+ public static CompletionStage> listAll(Sort sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with optional indexed parameters.
+ * This method is a shortcut for find(query, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Sort, Object...)
+ * @see #stream(String, Map)
+ * @see #stream(String, Parameters)
+ * @see #find(String, Object...)
+ * @see #list(String, Object...)
+ */
+ @GenerateBridge
+ public static Publisher stream(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with optional indexed parameters.
+ * This method is a shortcut for find(query, sort, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params optional sequence of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Object...)
+ * @see #stream(String, Sort, Map)
+ * @see #stream(String, Sort, Parameters)
+ * @see #find(String, Sort, Object...)
+ * @see #list(String, Sort, Object...)
+ */
+ @GenerateBridge
+ public static Publisher stream(String query, Sort sort, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Sort, Map)
+ * @see #stream(String, Object...)
+ * @see #stream(String, Parameters)
+ * @see #find(String, Map)
+ * @see #list(String, Map)
+ */
+ @GenerateBridge
+ public static Publisher stream(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Map} of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Map)
+ * @see #stream(String, Sort, Object...)
+ * @see #stream(String, Sort, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #list(String, Sort, Map)
+ */
+ @GenerateBridge
+ public static Publisher stream(String query, Sort sort,
+ Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Sort, Parameters)
+ * @see #stream(String, Object...)
+ * @see #stream(String, Map)
+ * @see #find(String, Parameters)
+ * @see #list(String, Parameters)
+ */
+ @GenerateBridge
+ public static Publisher stream(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Parameters} of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Parameters)
+ * @see #stream(String, Sort, Object...)
+ * @see #stream(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static Publisher stream(String query, Sort sort, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a BSON query.
+ * This method is a shortcut for find(query).stream()
.
+ *
+ * @param query a {@link Document} query
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static Publisher stream(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a a BSON query and a BSON sort.
+ * This method is a shortcut for find(query, sort).stream()
.
+ *
+ * @param query a {@link Document} query
+ * @param sort the {@link Document} sort
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public static Publisher stream(Document query, Document sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type.
+ * This method is a shortcut for findAll().stream()
.
+ *
+ * @return a {@link Stream} containing all results, without paging
+ * @see #streamAll(Sort)
+ * @see #findAll()
+ * @see #listAll()
+ */
+ @GenerateBridge
+ public static Publisher streamAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type, in the given order.
+ * This method is a shortcut for findAll(sort).stream()
.
+ *
+ * @param sort the sort order to use
+ * @return a {@link Stream} containing all results, without paging
+ * @see #streamAll()
+ * @see #findAll(Sort)
+ * @see #listAll(Sort)
+ */
+ @GenerateBridge
+ public static Publisher streamAll(Sort sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity in the database.
+ *
+ * @return the number of this type of entity in the database.
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ * @see #count(String, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage count() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return the number of entities counted.
+ * @see #count()
+ * @see #count(String, Map)
+ * @see #count(String, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage count(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return the number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage count(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return the number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ */
+ @GenerateBridge
+ public static CompletionStage count(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query
+ *
+ * @param query a {@link Document} query
+ * @return he number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ */
+ @GenerateBridge
+ public static CompletionStage count(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type from the database.
+ *
+ * @return the number of entities deleted.
+ * @see #delete(String, Object...)
+ * @see #delete(String, Map)
+ * @see #delete(String, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage deleteAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return the number of entities deleted.
+ * @see #deleteAll()
+ * @see #delete(String, Map)
+ * @see #delete(String, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage delete(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return the number of entities deleted.
+ * @see #deleteAll()
+ * @see #delete(String, Object...)
+ * @see #delete(String, Parameters)
+ */
+ @GenerateBridge
+ public static CompletionStage delete(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return the number of entities deleted.
+ * @see #deleteAll()
+ * @see #delete(String, Object...)
+ * @see #delete(String, Map)
+ */
+ @GenerateBridge
+ public static CompletionStage delete(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query
+ *
+ * @param query a {@link Document} query
+ * @return he number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ */
+ @GenerateBridge
+ public static CompletionStage delete(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Insert all given entities.
+ *
+ * @param entities the entities to insert
+ * @see #persist()
+ * @see #persist(Stream)
+ * @see #persist(Object,Object...)
+ */
+ public static CompletionStage persist(Iterable> entities) {
+ return ReactiveMongoOperations.persist(entities);
+ }
+
+ /**
+ * Insert all given entities.
+ *
+ * @param entities the entities to insert
+ * @see #persist()
+ * @see #persist(Iterable)
+ * @see #persist(Object,Object...)
+ */
+ public static CompletionStage persist(Stream> entities) {
+ return ReactiveMongoOperations.persist(entities);
+ }
+
+ /**
+ * Insert all given entities.
+ *
+ * @param entities the entities to update
+ * @see #persist()
+ * @see #persist(Stream)
+ * @see #persist(Iterable)
+ */
+ public static CompletionStage persist(Object firstEntity, Object... entities) {
+ return ReactiveMongoOperations.persist(firstEntity, entities);
+ }
+
+ /**
+ * Update all given entities.
+ *
+ * @param entities the entities to update
+ * @see #update()
+ * @see #update(Stream)
+ * @see #update(Object,Object...)
+ */
+ public static CompletionStage update(Iterable> entities) {
+ return ReactiveMongoOperations.update(entities);
+ }
+
+ /**
+ * Update all given entities.
+ *
+ * @param entities the entities to insert
+ * @see #update()
+ * @see #update(Iterable)
+ * @see #update(Object,Object...)
+ */
+ public static CompletionStage update(Stream> entities) {
+ return ReactiveMongoOperations.update(entities);
+ }
+
+ /**
+ * Update all given entities.
+ *
+ * @param entities the entities to update
+ * @see #update()
+ * @see #update(Stream)
+ * @see #update(Iterable)
+ */
+ public static CompletionStage update(Object firstEntity, Object... entities) {
+ return ReactiveMongoOperations.update(firstEntity, entities);
+ }
+
+ /**
+ * Persist all given entities or update them if they already exist.
+ *
+ * @param entities the entities to update
+ * @see #persistOrUpdate()
+ * @see #persistOrUpdate(Stream)
+ * @see #persistOrUpdate(Object,Object...)
+ */
+ public static CompletionStage persistOrUpdate(Iterable> entities) {
+ return ReactiveMongoOperations.persistOrUpdate(entities);
+ }
+
+ /**
+ * Persist all given entities.
+ *
+ * @param entities the entities to insert
+ * @see #persistOrUpdate()
+ * @see #persistOrUpdate(Iterable)
+ * @see #persistOrUpdate(Object,Object...)
+ */
+ public static CompletionStage persistOrUpdate(Stream> entities) {
+ return ReactiveMongoOperations.persistOrUpdate(entities);
+ }
+
+ /**
+ * Persist all given entities.
+ *
+ * @param entities the entities to update
+ * @see #persistOrUpdate()
+ * @see #persistOrUpdate(Stream)
+ * @see #persistOrUpdate(Iterable)
+ */
+ public static CompletionStage persistOrUpdate(Object firstEntity, Object... entities) {
+ return ReactiveMongoOperations.persistOrUpdate(firstEntity, entities);
+ }
+
+ /**
+ * Allow to access the underlying Mongo Collection.
+ */
+ @GenerateBridge
+ public static ReactiveMongoCollection mongoCollection() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Allow to access the underlying Mongo Database.
+ */
+ @GenerateBridge
+ public static ReactiveMongoDatabase mongoDatabase() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+}
diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoRepository.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoRepository.java
new file mode 100644
index 0000000000000..e64de1e7a0554
--- /dev/null
+++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoRepository.java
@@ -0,0 +1,15 @@
+package io.quarkus.mongodb.panache.axle;
+
+import org.bson.types.ObjectId;
+
+/**
+ * Represents a Repository for a specific type of entity {@code Entity}, with an ID type
+ * of {@code ObjectId}. Implementing this repository will gain you the exact same useful methods
+ * that are on {@link ReactivePanacheMongoEntityBase}. If you have a custom ID strategy, you should
+ * implement {@link ReactivePanacheMongoRepositoryBase} instead.
+ *
+ * @param The type of entity to operate on
+ */
+public interface ReactivePanacheMongoRepository extends ReactivePanacheMongoRepositoryBase {
+
+}
diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoRepositoryBase.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoRepositoryBase.java
new file mode 100644
index 0000000000000..61db1b7959b43
--- /dev/null
+++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheMongoRepositoryBase.java
@@ -0,0 +1,889 @@
+package io.quarkus.mongodb.panache.axle;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.CompletionStage;
+import java.util.stream.Stream;
+
+import org.bson.Document;
+import org.reactivestreams.Publisher;
+
+import io.quarkus.mongodb.ReactiveMongoCollection;
+import io.quarkus.mongodb.ReactiveMongoDatabase;
+import io.quarkus.mongodb.panache.axle.runtime.ReactiveMongoOperations;
+import io.quarkus.panache.common.Parameters;
+import io.quarkus.panache.common.Sort;
+import io.quarkus.panache.common.impl.GenerateBridge;
+
+/**
+ * Represents a Repository for a specific type of entity {@code Entity}, with an ID type
+ * of {@code Id}. Implementing this repository will gain you the exact same useful methods
+ * that are on {@link ReactivePanacheMongoEntityBase}. Unless you have a custom ID strategy, you should not
+ * implement this interface directly but implement {@link ReactivePanacheMongoRepository} instead.
+ *
+ * @param The type of entity to operate on
+ * @param The ID type of the entity
+ * @see ReactivePanacheMongoRepository
+ */
+public interface ReactivePanacheMongoRepositoryBase {
+
+ // Operations
+
+ /**
+ * Persist the given entity in the database.
+ * This will set it's ID field if not already set.
+ *
+ * @param entity the entity to insert.
+ * @see #persist(Iterable)
+ * @see #persist(Stream)
+ * @see #persist(Object, Object...)
+ */
+ public default CompletionStage persist(Entity entity) {
+ return ReactiveMongoOperations.persist(entity);
+ }
+
+ /**
+ * Update the given entity in the database.
+ *
+ * @param entity the entity to update.
+ * @see #update(Iterable)
+ * @see #update(Stream)
+ * @see #update(Object, Object...)
+ */
+ public default CompletionStage update(Entity entity) {
+ return ReactiveMongoOperations.update(entity);
+ }
+
+ /**
+ * Persist the given entity in the database or update it if it already exist.
+ *
+ * @param entity the entity to update.
+ * @see #persistOrUpdate(Iterable)
+ * @see #persistOrUpdate(Stream)
+ * @see #persistOrUpdate(Object, Object...)
+ */
+ public default CompletionStage persistOrUpdate(Entity entity) {
+ return ReactiveMongoOperations.persistOrUpdate(entity);
+ }
+
+ /**
+ * Delete the given entity from the database, if it is already persisted.
+ *
+ * @param entity the entity to delete.
+ * @see #delete(String, Object...)
+ * @see #delete(String, Map)
+ * @see #delete(String, Parameters)
+ * @see #deleteAll()
+ */
+ public default CompletionStage delete(Entity entity) {
+ return ReactiveMongoOperations.delete(entity);
+ }
+
+ // Queries
+
+ /**
+ * Find an entity of this type by ID.
+ *
+ * @param id the ID of the entity to find.
+ * @return the entity found, or null
if not found.
+ */
+ @GenerateBridge
+ public default CompletionStage findById(Id id) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find an entity of this type by ID.
+ *
+ * @param id the ID of the entity to find.
+ * @return if found, an optional containing the entity, else Optional.empty()
.
+ */
+ @GenerateBridge
+ public default CompletionStage> findByIdOptional(Object id) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Sort, Object...)
+ * @see #find(String, Map)
+ * @see #find(String, Parameters)
+ * @see #list(String, Object...)
+ * @see #stream(String, Object...)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query and the given sort options, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params optional sequence of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Object...)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Object...)
+ * @see #stream(String, Sort, Object...)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(String query, Sort sort, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Object...)
+ * @see #find(String, Parameters)
+ * @see #list(String, Map)
+ * @see #stream(String, Map)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query and the given sort options, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Map} of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Map)
+ * @see #find(String, Sort, Object...)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Map)
+ * @see #stream(String, Sort, Map)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(String query, Sort sort, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Sort, Parameters)
+ * @see #find(String, Map)
+ * @see #find(String, Parameters)
+ * @see #list(String, Parameters)
+ * @see #stream(String, Parameters)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a query and the given sort options, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Parameters} of indexed parameters
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(String query, Sort sort, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a BSON query.
+ *
+ * @param query a {@link Document} query
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a a BSON query and a BSON sort.
+ *
+ * @param query a {@link Document} query
+ * @param sort the {@link Document} sort
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery find(Document query, Document sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type.
+ *
+ * @return a new {@link ReactivePanacheQuery} instance to find all entities of this type.
+ * @see #findAll(Sort)
+ * @see #listAll()
+ * @see #streamAll()
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery findAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type, in the given order.
+ *
+ * @param sort the sort order to use
+ * @return a new {@link ReactivePanacheQuery} instance to find all entities of this type.
+ * @see #findAll()
+ * @see #listAll(Sort)
+ * @see #streamAll(Sort)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery findAll(Sort sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with optional indexed parameters.
+ * This method is a shortcut for find(query, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Sort, Object...)
+ * @see #list(String, Map)
+ * @see #list(String, Parameters)
+ * @see #find(String, Object...)
+ * @see #stream(String, Object...)
+ */
+ @GenerateBridge
+ public default CompletionStage> list(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with optional indexed parameters.
+ * This method is a shortcut for find(query, sort, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params optional sequence of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Object...)
+ * @see #list(String, Sort, Map)
+ * @see #list(String, Sort, Parameters)
+ * @see #find(String, Sort, Object...)
+ * @see #stream(String, Sort, Object...)
+ */
+ @GenerateBridge
+ public default CompletionStage> list(String query, Sort sort, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Sort, Map)
+ * @see #list(String, Object...)
+ * @see #list(String, Parameters)
+ * @see #find(String, Map)
+ * @see #stream(String, Map)
+ */
+ @GenerateBridge
+ public default CompletionStage> list(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Map} of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Map)
+ * @see #list(String, Sort, Object...)
+ * @see #list(String, Sort, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #stream(String, Sort, Map)
+ */
+ @GenerateBridge
+ public default CompletionStage> list(String query, Sort sort, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Sort, Parameters)
+ * @see #list(String, Object...)
+ * @see #list(String, Map)
+ * @see #find(String, Parameters)
+ * @see #stream(String, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage> list(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).list()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Parameters} of indexed parameters
+ * @return a {@link List} containing all results, without paging
+ * @see #list(String, Parameters)
+ * @see #list(String, Sort, Object...)
+ * @see #list(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage> list(String query, Sort sort, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a BSON query.
+ * This method is a shortcut for find(query).list()
.
+ *
+ * @param query a {@link Document} query
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery list(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a a BSON query and a BSON sort.
+ * This method is a shortcut for find(query, sort).list()
.
+ *
+ * @param query a {@link Document} query
+ * @param sort the {@link Document} sort
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default ReactivePanacheQuery list(Document query, Document sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type.
+ * This method is a shortcut for findAll().list()
.
+ *
+ * @return a {@link List} containing all results, without paging
+ * @see #listAll(Sort)
+ * @see #findAll()
+ * @see #streamAll()
+ */
+ @GenerateBridge
+ public default CompletionStage> listAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type, in the given order.
+ * This method is a shortcut for findAll(sort).list()
.
+ *
+ * @param sort the sort order to use
+ * @return a {@link List} containing all results, without paging
+ * @see #listAll()
+ * @see #findAll(Sort)
+ * @see #streamAll(Sort)
+ */
+ @GenerateBridge
+ public default CompletionStage> listAll(Sort sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with optional indexed parameters.
+ * This method is a shortcut for find(query, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Sort, Object...)
+ * @see #stream(String, Map)
+ * @see #stream(String, Parameters)
+ * @see #find(String, Object...)
+ * @see #list(String, Object...)
+ */
+ @GenerateBridge
+ public default Publisher stream(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with optional indexed parameters.
+ * This method is a shortcut for find(query, sort, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params optional sequence of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Object...)
+ * @see #stream(String, Sort, Map)
+ * @see #stream(String, Sort, Parameters)
+ * @see #find(String, Sort, Object...)
+ * @see #list(String, Sort, Object...)
+ */
+ @GenerateBridge
+ public default Publisher stream(String query, Sort sort, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Sort, Map)
+ * @see #stream(String, Object...)
+ * @see #stream(String, Parameters)
+ * @see #find(String, Map)
+ * @see #list(String, Map)
+ */
+ @GenerateBridge
+ public default Publisher stream(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Map} of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Map)
+ * @see #stream(String, Sort, Object...)
+ * @see #stream(String, Sort, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #list(String, Sort, Map)
+ */
+ @GenerateBridge
+ public default Publisher stream(String query, Sort sort, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query, with named parameters.
+ * This method is a shortcut for find(query, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Sort, Parameters)
+ * @see #stream(String, Object...)
+ * @see #stream(String, Map)
+ * @see #find(String, Parameters)
+ * @see #list(String, Parameters)
+ */
+ @GenerateBridge
+ public default Publisher stream(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities matching a query and the given sort options, with named parameters.
+ * This method is a shortcut for find(query, sort, params).stream()
.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param sort the sort strategy to use
+ * @param params {@link Parameters} of indexed parameters
+ * @return a {@link Stream} containing all results, without paging
+ * @see #stream(String, Parameters)
+ * @see #stream(String, Sort, Object...)
+ * @see #stream(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default Publisher stream(String query, Sort sort, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a BSON query.
+ * This method is a shortcut for find(query).stream()
.
+ *
+ * @param query a {@link Document} query
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default Publisher stream(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find entities using a a BSON query and a BSON sort.
+ * This method is a shortcut for find(query, sort).stream()
.
+ *
+ * @param query a {@link Document} query
+ * @param sort the {@link Document} sort
+ * @return a new {@link ReactivePanacheQuery} instance for the given query
+ * @see #find(String, Parameters)
+ * @see #find(String, Sort, Map)
+ * @see #find(String, Sort, Parameters)
+ * @see #list(String, Sort, Parameters)
+ * @see #stream(String, Sort, Parameters)
+ */
+ @GenerateBridge
+ public default Publisher stream(Document query, Document sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type.
+ * This method is a shortcut for findAll().stream()
.
+ *
+ * @return a {@link Stream} containing all results, without paging
+ * @see #streamAll(Sort)
+ * @see #findAll()
+ * @see #listAll()
+ */
+ @GenerateBridge
+ public default Publisher streamAll(Sort sort) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Find all entities of this type, in the given order.
+ * This method is a shortcut for findAll(sort).stream()
.
+ *
+ * @return a {@link Stream} containing all results, without paging
+ * @see #streamAll()
+ * @see #findAll(Sort)
+ * @see #listAll(Sort)
+ */
+ @GenerateBridge
+ public default Publisher streamAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity in the database.
+ *
+ * @return the number of this type of entity in the database.
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ * @see #count(String, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage count() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return the number of entities counted.
+ * @see #count()
+ * @see #count(String, Map)
+ * @see #count(String, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage count(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return the number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage count(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return the number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ */
+ @GenerateBridge
+ public default CompletionStage count(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Counts the number of this type of entity matching the given query
+ *
+ * @param query a {@link Document} query
+ * @return he number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ */
+ @GenerateBridge
+ public default CompletionStage count(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type from the database.
+ *
+ * @return the number of entities deleted.
+ * @see #delete(String, Object...)
+ * @see #delete(String, Map)
+ * @see #delete(String, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage deleteAll() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query, with optional indexed parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params optional sequence of indexed parameters
+ * @return the number of entities deleted.
+ * @see #deleteAll()
+ * @see #delete(String, Map)
+ * @see #delete(String, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage delete(String query, Object... params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Map} of named parameters
+ * @return the number of entities deleted.
+ * @see #deleteAll()
+ * @see #delete(String, Object...)
+ * @see #delete(String, Parameters)
+ */
+ @GenerateBridge
+ public default CompletionStage delete(String query, Map params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query, with named parameters.
+ *
+ * @param query a {@link io.quarkus.mongodb.panache query string}
+ * @param params {@link Parameters} of named parameters
+ * @return the number of entities deleted.
+ * @see #deleteAll()
+ * @see #delete(String, Object...)
+ * @see #delete(String, Map)
+ */
+ @GenerateBridge
+ public default CompletionStage delete(String query, Parameters params) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Delete all entities of this type matching the given query
+ *
+ * @param query a {@link Document} query
+ * @return he number of entities counted.
+ * @see #count()
+ * @see #count(String, Object...)
+ * @see #count(String, Map)
+ */
+ @GenerateBridge
+ public default CompletionStage delete(Document query) {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Persist all given entities.
+ *
+ * @param entities the entities to insert
+ * @see #persist(Object)
+ * @see #persist(Stream)
+ * @see #persist(Object,Object...)
+ */
+ public default CompletionStage persist(Iterable entities) {
+ return ReactiveMongoOperations.persist(entities);
+ }
+
+ /**
+ * Persist all given entities.
+ *
+ * @param entities the entities to insert
+ * @see #persist(Object)
+ * @see #persist(Iterable)
+ * @see #persist(Object,Object...)
+ */
+ public default CompletionStage persist(Stream entities) {
+ return ReactiveMongoOperations.persist(entities);
+ }
+
+ /**
+ * Persist all given entities.
+ *
+ * @param entities the entities to insert
+ * @see #persist(Object)
+ * @see #persist(Stream)
+ * @see #persist(Iterable)
+ */
+ public default CompletionStage persist(Entity firstEntity, @SuppressWarnings("unchecked") Entity... entities) {
+ return ReactiveMongoOperations.persist(firstEntity, entities);
+ }
+
+ /**
+ * Update all given entities.
+ *
+ * @param entities the entities to update
+ * @see #update(Object)
+ * @see #update(Stream)
+ * @see #update(Object,Object...)
+ */
+ public default CompletionStage update(Iterable entities) {
+ return ReactiveMongoOperations.update(entities);
+ }
+
+ /**
+ * Update all given entities.
+ *
+ * @param entities the entities to update
+ * @see #update(Object)
+ * @see #update(Iterable)
+ * @see #update(Object,Object...)
+ */
+ public default CompletionStage update(Stream entities) {
+ return ReactiveMongoOperations.update(entities);
+ }
+
+ /**
+ * Update all given entities.
+ *
+ * @param entities the entities to update
+ * @see #update(Object)
+ * @see #update(Stream)
+ * @see #update(Iterable)
+ */
+ public default CompletionStage update(Entity firstEntity, @SuppressWarnings("unchecked") Entity... entities) {
+ return ReactiveMongoOperations.update(firstEntity, entities);
+ }
+
+ /**
+ * Persist all given entities or update them if they already exist.
+ *
+ * @param entities the entities to update
+ * @see #persistOrUpdate(Object)
+ * @see #persistOrUpdate(Stream)
+ * @see #persistOrUpdate(Object,Object...)
+ */
+ public default CompletionStage persistOrUpdate(Iterable entities) {
+ return ReactiveMongoOperations.persistOrUpdate(entities);
+ }
+
+ /**
+ * Persist all given entities or update them if they already exist.
+ *
+ * @param entities the entities to update
+ * @see #persistOrUpdate(Object)
+ * @see #persistOrUpdate(Iterable)
+ * @see #persistOrUpdate(Object,Object...)
+ */
+ public default CompletionStage persistOrUpdate(Stream entities) {
+ return ReactiveMongoOperations.persistOrUpdate(entities);
+ }
+
+ /**
+ * Persist all given entities or update them if they already exist.
+ *
+ * @param entities the entities to update
+ * @see #update(Object)
+ * @see #update(Stream)
+ * @see #update(Iterable)
+ */
+ public default CompletionStage persistOrUpdate(Entity firstEntity,
+ @SuppressWarnings("unchecked") Entity... entities) {
+ return ReactiveMongoOperations.persistOrUpdate(firstEntity, entities);
+ }
+
+ /**
+ * Allow to access the underlying Mongo Collection
+ */
+ @GenerateBridge
+ public default ReactiveMongoCollection mongoCollection() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+
+ /**
+ * Allow to access the underlying Mongo Database.
+ */
+ @GenerateBridge
+ public default ReactiveMongoDatabase mongoDatabase() {
+ throw ReactiveMongoOperations.implementationInjectionMissing();
+ }
+}
diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheQuery.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheQuery.java
new file mode 100644
index 0000000000000..5cf719da92d34
--- /dev/null
+++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/ReactivePanacheQuery.java
@@ -0,0 +1,179 @@
+package io.quarkus.mongodb.panache.axle;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.CompletionStage;
+import java.util.stream.Stream;
+
+import org.reactivestreams.Publisher;
+
+import io.quarkus.panache.common.Page;
+
+/**
+ * Interface representing an entity query, which abstracts the use of paging, getting the number of results, and
+ * operating on {@link List} or {@link Stream}.
+ *
+ * Instances of this interface cannot mutate the query itself or its parameters: only paging information can be
+ * modified, and instances of this interface can be reused to obtain multiple pages of results.
+ *
+ * @param The entity type being queried
+ */
+public interface ReactivePanacheQuery {
+
+ // Builder
+
+ /**
+ * Sets the current page.
+ *
+ * @param page the new page
+ * @return this query, modified
+ * @see #page(int, int)
+ * @see #page()
+ */
+ public ReactivePanacheQuery page(Page page);
+
+ /**
+ * Sets the current page.
+ *
+ * @param pageIndex the page index
+ * @param pageSize the page size
+ * @return this query, modified
+ * @see #page(Page)
+ * @see #page()
+ */
+ public ReactivePanacheQuery page(int pageIndex, int pageSize);
+
+ /**
+ * Sets the current page to the next page
+ *
+ * @return this query, modified
+ * @see #previousPage()
+ */
+ public ReactivePanacheQuery nextPage();
+
+ /**
+ * Sets the current page to the previous page (or the first page if there is no previous page)
+ *
+ * @return this query, modified
+ * @see #nextPage()
+ */
+ public ReactivePanacheQuery previousPage();
+
+ /**
+ * Sets the current page to the first page
+ *
+ * @return this query, modified
+ * @see #lastPage()
+ */
+ public ReactivePanacheQuery firstPage();
+
+ /**
+ * Sets the current page to the last page. This will cause reading of the entity count.
+ *
+ * @return this query, modified
+ * @see #firstPage()
+ * @see #count()
+ */
+ public CompletionStage> lastPage();
+
+ /**
+ * Returns true if there is another page to read after the current one.
+ * This will cause reading of the entity count.
+ *
+ * @return true if there is another page to read
+ * @see #hasPreviousPage()
+ * @see #count()
+ */
+ public CompletionStage hasNextPage();
+
+ /**
+ * Returns true if there is a page to read before the current one.
+ *
+ * @return true if there is a previous page to read
+ * @see #hasNextPage()
+ */
+ public boolean hasPreviousPage();
+
+ /**
+ * Returns the total number of pages to be read using the current page size.
+ * This will cause reading of the entity count.
+ *
+ * @return the total number of pages to be read using the current page size.
+ */
+ public CompletionStage pageCount();
+
+ /**
+ * Returns the current page.
+ *
+ * @return the current page
+ * @see #page(Page)
+ * @see #page(int,int)
+ */
+ public Page page();
+
+ // Results
+
+ /**
+ * Reads and caches the total number of entities this query operates on. This causes a database
+ * query with SELECT COUNT(*)
and a query equivalent to the current query, minus
+ * ordering.
+ *
+ * @return the total number of entities this query operates on, cached.
+ */
+ public CompletionStage count();
+
+ /**
+ * Returns the current page of results as a {@link List}.
+ *
+ * @return the current page of results as a {@link List}.
+ * @see #page(Page)
+ * @see #page()
+ */
+ public CompletionStage> list();
+
+ /**
+ * Returns the current page of results as a {@link Stream}.
+ *
+ * @return the current page of results as a {@link Stream}.
+ * @see #list()
+ * @see #page(Page)
+ * @see #page()
+ */
+ public Publisher stream();
+
+ /**
+ * Returns the first result of the current page index. This ignores the current page size to fetch
+ * a single result.
+ *
+ * @return the first result of the current page index, or null if there are no results.
+ * @see #singleResult()
+ */
+ public CompletionStage firstResult();
+
+ /**
+ * Returns the first result of the current page index. This ignores the current page size to fetch
+ * a single result.
+ *
+ * @return if found, an optional containing the entity, else Optional.empty()
.
+ * @see #singleResultOptional()
+ */
+ public CompletionStage> firstResultOptional();
+
+ /**
+ * Executes this query for the current page and return a single result.
+ *
+ * @return the single result.
+ * @throws io.quarkus.panache.common.exception.PanacheQueryException if there are more than one result.
+ * @see #firstResult()
+ */
+ public CompletionStage singleResult();
+
+ /**
+ * Executes this query for the current page and return a single result.
+ *
+ * @return if found, an optional containing the entity, else Optional.empty()
.
+ * @throws io.quarkus.panache.common.exception.PanacheQueryException if there are more than one result.
+ * @see #firstResultOptional()
+ */
+ public CompletionStage> singleResultOptional();
+}
diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/runtime/ReactiveMongoOperations.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/runtime/ReactiveMongoOperations.java
new file mode 100644
index 0000000000000..922954d92ecd3
--- /dev/null
+++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/axle/runtime/ReactiveMongoOperations.java
@@ -0,0 +1,577 @@
+package io.quarkus.mongodb.panache.axle.runtime;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.bson.BsonDocument;
+import org.bson.BsonDocumentWriter;
+import org.bson.BsonValue;
+import org.bson.Document;
+import org.bson.codecs.Codec;
+import org.bson.codecs.EncoderContext;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.eclipse.microprofile.context.ThreadContext;
+import org.jboss.logging.Logger;
+import org.reactivestreams.Publisher;
+
+import com.mongodb.client.model.InsertOneModel;
+import com.mongodb.client.model.ReplaceOneModel;
+import com.mongodb.client.model.ReplaceOptions;
+import com.mongodb.client.model.UpdateOptions;
+import com.mongodb.client.model.WriteModel;
+
+import io.quarkus.arc.Arc;
+import io.quarkus.mongodb.ReactiveMongoClient;
+import io.quarkus.mongodb.ReactiveMongoCollection;
+import io.quarkus.mongodb.ReactiveMongoDatabase;
+import io.quarkus.mongodb.panache.MongoEntity;
+import io.quarkus.mongodb.panache.axle.ReactivePanacheQuery;
+import io.quarkus.mongodb.panache.binder.NativeQueryBinder;
+import io.quarkus.mongodb.panache.binder.PanacheQlQueryBinder;
+import io.quarkus.panache.common.Parameters;
+import io.quarkus.panache.common.Sort;
+
+public class ReactiveMongoOperations {
+ private static final Logger LOGGER = Logger.getLogger(ReactiveMongoOperations.class);
+ public static final String ID = "_id";
+ public static final String MONGODB_DATABASE = "quarkus.mongodb.database";
+ //
+ // Instance methods
+
+ public static CompletionStage persist(Object entity) {
+ ReactiveMongoCollection collection = mongoCollection(entity);
+ return persist(collection, entity);
+ }
+
+ public static CompletionStage persist(Iterable> entities) {
+ // not all iterables are re-traversal, so we traverse it once for copying inside a list
+ List