[ 
https://issues.apache.org/jira/browse/CAMEL-17057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17475744#comment-17475744
 ] 

Karen Lease commented on CAMEL-17057:
-------------------------------------

It already works like that. In fact, if you specify hosts, then you can use a 
URL like the one in the (working) test below with no name for the connection 
bean:
{code:java}
 
@Test
    void testMongoDbEndpoint() {
        MongoDbEndpoint mongoDb = 
context.getEndpoint("mongodb:?hosts=localhost&database=test&collection=test&operation=findAll",
                MongoDbEndpoint.class);
        assertNotNull(mongoDb);
        assertNotNull(mongoDb.getMongoConnection());
        assertNotNull(mongoDb.getMongoConnection().getDatabase("test"));
        assertEquals("test", mongoDb.getCollection());
        assertEquals("findAll", mongoDb.getOperation().toString());
    }
{code}
I could add such a test to the code base and also add such a sample URL to the 
documentation.
 

> camel-mongodb - Make it easier to configuring that dreadful MongoDBClientURI
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-17057
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17057
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-mongodb
>            Reporter: Claus Ibsen
>            Priority: Major
>             Fix For: 3.15.0
>
>
> Using mongodb is not as easy to configure when you need to use that mongodb 
> client url that has a ton of configurations in a string. 
> Today you have to create that MongoDBClient instance yourself via 
> constructors, so you end up having to write Java code.
> For *** sake could they not just make their client api easier to configure.
> On chat forum
> https://camel.zulipchat.com/#narrow/stream/257299-camel-k/topic/MongoDB.20connection.20configuration



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to