[CSHARP-878] MongoUrlBuilder - Connection String without mongodb:// fails to parse Created: 16/Dec/13  Updated: 16/Dec/13  Resolved: 16/Dec/13

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.8.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Yaniv Schiller Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

	var csb = new MongoDB.Driver.MongoConnectionStringBuilder();
	csb.Server = new MongoServerAddress(@"ca-spain-vm");
	csb.DatabaseName = @"scheduler-1_0";
	var cs = csb.ConnectionString;
 
	var urlb = new MongoUrlBuilder(cs); //throws Exception - 

i believe MongoUrlBuilder used to parse the connection sting without an error.

And/Or add a ConnectionUrl property in a MongoConnectionStringBuilder that would return a mongodb:// url.

thank you



 Comments   
Comment by Craig Wilson [ 16/Dec/13 ]

No problem. Closing this ticket.

Comment by Yaniv Schiller [ 16/Dec/13 ]

Craig,

I missed the MongoUrlBuilder class, i was trying to build a URL with the ConnectionStringBuilder.

Thank you

Comment by Craig Wilson [ 16/Dec/13 ]

Hi Yaniv,
The code you provided doesn't compile. Specifically, a MongoConnectionStringBuilder does not have a ConnectionString property. Therefore, I'm a little confused as to what exactly you are trying to accomplish. Would you mind providing code that compiles to demonstrate your intentions?

As far as parsing without mongodb://, that has never been possible as it is an invalid mongodb url. We currently support 2 different types of connection strings though, one through the MongoConnectionStringBuilder and one through the MongoUrlBuilder/MongoUrl. You should never need to use both.

Thanks,
Craig

Generated at Wed Feb 07 21:38:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.