Skip to content

Documentation bug: Inconsistency in Mongo connection setup #44382

Closed as not planned
@michaldo

Description

@michaldo

On one hand documentation shows how to configure database with uri
https://docs.spring.io/spring-boot/reference/data/nosql.html#data.nosql.mongodb.connecting

as shown in the following example:

spring:
  data:
    mongodb:
      uri: "mongodb://user:secret@mongoserver1.example.com:27017,mongoserver2.example.com:23456/test"

On the other hand property reference denies uri configurability

https://docs.spring.io/spring-boot/appendix/application-properties/index.html#application-properties.data.spring.data.mongodb.port

spring.data.mongodb.port | Mongo server port. Cannot be set with URI.
spring.data.mongodb.uri | Mongo database URI. Overrides host, port, username, and password.
spring.data.mongodb.database | Database name. Overrides database in URI.
spring.data.mongodb.host | Mongo server host. Cannot be set with URI.
spring.data.mongodb.password | Login password of the mongo server. Cannot be set with URI.
spring.data.mongodb.replica-set-name | Required replica set name for the cluster. Cannot be set with URI.

Unable to understand, basing on documentation, what is allowed in URI and what overrides what

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions