MongoDB connection string with options
See original GitHub issueMy mongodb connection string looks like: “mongodb://user:password@localhost:27017/Identity?ssl=true&authSource=admin” when I break it to MongoDbSettings as
"MongoDbSettings": { "ConnectionString": "mongodb://user:password@localhost:27017/", "DatabaseName": "Identity?ssl=true&authSource=admin" }
I can’t connect to the database, am I doing something wrong?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Connection String URI Format
A query string that specifies connection specific options as <name>=<value> pairs. See Connection String Options for a full description of these options.
Read more >Connection String URI Format
Standard Connection String Format¶. This section describes the standard format of the MongoDB connection URI used to connect to a MongoDB database server....
Read more >MongoDB Connection String | Introduction
There are three types of MongoDB connection string that you'll encounter: A MongoDB Atlas connection string, a connection string for an instance running...
Read more >Connection String in MongoDB (with examples)
The standard format for connecting strings. There are three basic types of MongoDB deployments: standalone, replica set, and sharded cluster, ...
Read more >Get Connection String — Start with Guides
Navigate to the Database Deployments page for your project. · Click the Connect button. · Copy the connection string.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Currently, there is no interface allowing you to pass an SSL cert, but you can easily create a custom class inheriting from
MongoDbContext
with your desired parameters and pass it to the extension:To create a
MongoDbContext
, you can look in theMongoDbGenericRepository
documentation, which is a dependency from the AspNetCore.Identity.MongoDbCore nuget package.There is a MongoDbContext constructor that takes a MongoDbDatabase.
You can use a custom class inheriting from
MongoDbContext
that implements all the functionality you need, including a constructor or methods that take a certificate. The current implementation can be seen here.Thanks! Where do I set the certificate path and password for the SSL hand shake?