A good solution could be using the Computed Pattern
Building with Patterns: The Computed Pattern | MongoDB