How to create database in MongoDB?

MongoDB Connection String UserName Password C#

According to MongoDB docs,

“The mongodb  connection string username and password are optional. If username and password are specified in connection string, the client will attempt to log in to the specific database using the same credentials after connecting to the MongoDB instance.”

The mongodb connection string URL's standard format and used to connect to MongoDB database server.

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

Optional Parameters:
·         :port1,
·         hostX,
·         :portX ,
·         username:password@

Required Parameters:
·         mongodb://,
·         host1

The default value of “:port1”, “portX”, and “:portX” is "27017"

Example, the following MongoDB hosts

db1.code-sample.com on port 27017 and db2.code-sample.com on port 2500

The mongodb connection string looks like,
mongodb://db1.code-sample.com,db2.code-sample.com:2500/?replicaSet=test


Stayed Informed - Why use MongoDB in MVC .Net?

I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

MongoDB Connection String UserName Password C# MongoDB Connection String UserName Password C# Reviewed by Anil Singh on 4:51 AM Rating: (5)
www.code-sample.com/. Powered by Blogger.
^