Skip to content

Commit 685990b

Browse files
John Lilleymp911de
John Lilley
authored andcommitted
DATAMONGO-1508 - Document authentication-dbname attribute in db-factory.
Original pull request: #399.
1 parent ff83ac3 commit 685990b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/asciidoc/reference/mongodb.adoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,20 @@ You can also provide the host and port for the underlying `com.mongodb.Mongo` in
387387
password="secret"/>
388388
----
389389

390+
If your mongodb authentication database differs from the target database, use the authentication-dbname attribute, as shown below.
391+
392+
[source,xml]
393+
----
394+
<mongo:db-factory id="anotherMongoDbFactory"
395+
host="localhost"
396+
port="27017"
397+
dbname="database"
398+
username="joe"
399+
password="secret"
400+
authentication-dbname="admin"
401+
/>
402+
----
403+
390404
If you need to configure additional options on the `com.mongodb.Mongo` instance that is used to create a `SimpleMongoDbFactory` you can refer to an existing bean using the `mongo-ref` attribute as shown below. To show another common usage pattern, this listing shows the use of a property placeholder to parametrise the configuration and creating `MongoTemplate`.
391405

392406
[source,xml]

0 commit comments

Comments
 (0)