Make MongoDB collection names configurable for AAS and Submodel registries#875
Conversation
…ries - Introduced properties: - basyx.aasregistry.mongodb.collectionName (default: aasdescriptors) - basyx.submodelregistry.mongodb.collectionName (default: submodeldescriptors) - Removed @document annotations to avoid static collection binding - Preserved @id usage for MongoDB _id mapping refs eclipse-basyx#873
| @Log4j2 | ||
| public class MongoDbConfiguration { | ||
|
|
||
| @Value("${basyx.aasregistry.mongodb.collectionName:submodeldescriptors}") |
|
Quick thought: Changing the default collection name could be a breaking change for existing deployments - they'd lose access to their data after upgrading since the app would look for a different collection. |
|
It would be a breaking change if we had a full release of BaSyx Java (which is not the case). But you are right, this could potentially cause issues when the next milestone is released or if somebody deploys the snapshots. But having a semantically incorrect collection name is also not really helpful. Maybe it would be enough to inform users about this change once a release is published. This way they can just apply the necessary setting and won't loose their data |
|
You got a typo there @seicke . It's |
|
@aaronzi You are absoluty right, sorry for that! However, even with |
|
It has to be |
|
Yes, you are right. I missed that but it's clear from the code in this PR |
So what I have done now is I reverted both the default submodel registry collection name (to |

Description:
This MR introduces configurable properties for MongoDB collection names in the AAS Registry and Submodel Registry.
Previously, collection names were hardcoded via @document annotations. These have been replaced by configurable properties, allowing users to override them in application.yaml while still defaulting to the existing names.
Changes:
Added configuration properties:
basyx.aasregistry.mongodb.collectionName (default: aasdescriptors)
basyx.submodelregistry.mongodb.collectionName (default: submodeldescriptors)
Updated storage implementations to resolve collection names via configuration
Removed static @document annotations to avoid conflicts
Retained @id annotations for proper _id mapping in MongoDB
Adjusted Lombok configuration to ensure builds succeed with newer Java versions via Maven
Why:
Gives users flexibility to customize collection names for different environments or deployments, and improves build compatibility with modern Java versions.
Issue:
Closes #873