Using MongoDB
MongoDB is one of the supported databases that can be selected when your application is being generated.
When MongoDB is selected:
- Spring Data MongoDB will be used to access the database. This is very close to Spring Data JPA, and this is why MongoDB support is very close to the (default) JPA support
- Mongobee is used instead of Liquibase to manage database changes
- The entity sub-generator will not ask you for entity relationships, as you can’t have relationships with a NoSQL database (at least not in the way you have relationships with JPA)
- de.flapdoodle.embed.mongo is used to run an in-memory version of the database for running unit tests.
MongoDB Atlas
If you want to use MongoDB Atlas, you can encounter this error:
error: {
"ok" : 0,
"errmsg" : "user is not allowed to do action [find] on [mydb.system.indexes]",
"code" : 8000,
"codeName" : "AtlasError"
}
As Mongobee is not maintained anymore, you could migrate to Mongock. See:
- the ticket: issues/8665
- the proposal: issues/8678
- the question on StackOverFlow