...

/

Panache with MongoDB

Panache with MongoDB

Learn how to use a MongoDB database with Quarkus and Panache.

The Quarkus team provides an extension that simplifies the usage of a MongoDB database called mongodb-panache, which we can use to take advantage of the Panache helpers with a MongoDB database.

Adding the dependencies

To use the Panache MongoDB extension, we need to add it as a dependency using the commands below depending on your build tool.

Press + to interact
# Using Quarkus CLI
quarkus extension add 'mongodb-panache'
# Using Maven
./mvnw quarkus:add-extension -Dextensions='mongodb-panache'
# Using Gradle
./gradlew addExtension --extensions='mongodb-panache'

Using Panache

When using the Quarkus Panache extension, we can pick one of the two available patterns: the active record pattern or the repository pattern.

Active record pattern

The active record pattern relies on the created entities to make ...