The settings used to access a MongoDB server.
        public void TestDefaults()
        {
            var localhost = new MongoServerAddress("localhost");

            var settings = new MongoServerSettings();
            Assert.AreEqual(ConnectionMode.Direct, settings.ConnectionMode);
            Assert.AreEqual(MongoDefaults.ConnectTimeout, settings.ConnectTimeout);
            Assert.AreEqual(null, settings.DefaultCredentials);
            Assert.AreEqual(MongoDefaults.GuidRepresentation, settings.GuidRepresentation);
            Assert.AreEqual(false, settings.IPv6);
            Assert.AreEqual(MongoDefaults.MaxConnectionIdleTime, settings.MaxConnectionIdleTime);
            Assert.AreEqual(MongoDefaults.MaxConnectionLifeTime, settings.MaxConnectionLifeTime);
            Assert.AreEqual(MongoDefaults.MaxConnectionPoolSize, settings.MaxConnectionPoolSize);
            Assert.AreEqual(MongoDefaults.MinConnectionPoolSize, settings.MinConnectionPoolSize);
            Assert.AreEqual(ReadPreference.Primary, settings.ReadPreference);
            Assert.AreEqual(null, settings.ReplicaSetName);
            Assert.AreEqual(SafeMode.False, settings.SafeMode);
            Assert.AreEqual(1, settings.Servers.Count());
            Assert.AreEqual(localhost, settings.Server);
            Assert.AreEqual(localhost, settings.Servers.First());
            Assert.AreEqual(MongoDefaults.SocketTimeout, settings.SocketTimeout);
            Assert.AreEqual(MongoDefaults.ComputedWaitQueueSize, settings.WaitQueueSize);
            Assert.AreEqual(MongoDefaults.WaitQueueTimeout, settings.WaitQueueTimeout);

            Assert.IsFalse(settings.IsFrozen);
            var hashCode = settings.GetHashCode();
            var stringRepresentation = settings.ToString();
            Assert.AreEqual(settings, settings);

            settings.Freeze();
            Assert.IsTrue(settings.IsFrozen);
            Assert.AreEqual(hashCode, settings.GetHashCode());
            Assert.AreEqual(stringRepresentation, settings.ToString());
        }
Пример #2
0
        private static void Go(long userId)
        {
            var settings = new MongoServerSettings
            {
                Server = new MongoServerAddress("127.0.0.1", 27017),
                SafeMode = SafeMode.False
            };
            var mongoServer = new MongoServer(settings);

            var database = mongoServer.GetDatabase("Test");

            var map = new NoteMap();
            var collection = new EntityCollection<Note>(database, map.GetDescriptor(), true);

            var note = new Note
            {
                NoteID = "1",
                Title = "This is a book.",
                Content = "Oh yeah",
                UserID = 123321L
            };
            // collection.InsertOnSubmit(note);
            // collection.SubmitChanges();
            // var data = collection.SelectTo(n => new { n.NoteID, n.UserID });
            collection.Log = Console.Out;
            var a = 4;
            collection.Update(
                n => new Note { },
                n => true);
        }
        public void TestAddressFamilyObsolete(bool ipv6, AddressFamily addressFamily)
        {
#pragma warning disable 618
            var settings = new MongoServerSettings { IPv6 = ipv6 };
            Assert.AreEqual(addressFamily, settings.AddressFamily);
#pragma warning restore
        }
        public ExtendedMongoDBCheck(string connectionString, bool isReplSet, bool dbStats)
        {
            _isReplSet = isReplSet;
            _dbStats = dbStats;

            if (connectionString.Contains("mongodb://"))
            {
                _mongoServer = MongoServer.Create(string.Format("{0}{1}?slaveok=true", connectionString, connectionString.EndsWith("/") ? "" : "/"));
            }
            else
            {
                MongoServerSettings settings = new MongoServerSettings();
                if (connectionString.Contains(":"))
                {
                    string[] bits = connectionString.Split(':');
                    settings.Server = new MongoServerAddress(bits[0], Convert.ToInt32(bits[1]));
                }
                else
                {
                    settings.Server = new MongoServerAddress(connectionString);
                }
                settings.SlaveOk = true;
                _mongoServer = MongoServer.Create(settings);
            }
        }
Пример #5
0
        internal IRepository GetRepository()
        {
            // We have a connection string name, grab this from the config and pass it too the parser.
            if (!string.IsNullOrWhiteSpace(this.ConnectionName))
            {
                if (ConfigurationManager.ConnectionStrings[this.ConnectionName] == null ||
                    string.IsNullOrWhiteSpace(ConfigurationManager.ConnectionStrings[this.ConnectionName].ConnectionString))
                    throw new MongoConnectionException("The connection string name specified was not found.");

                return GetProvider().GetRepository(
                        ConfigurationManager.ConnectionStrings[this.ConnectionName].ConnectionString,
                        this.Database);
            }
            
            // We have a connection string
            if (!string.IsNullOrWhiteSpace(this.ConnectionString))
                return GetProvider().GetRepository(this.ConnectionString, this.Database);

            // No connection strings at all, use the old method using the properties
            var database = this.Database;
            var settings = new MongoServerSettings {Server = new MongoServerAddress(this.Host, this.Port)};
            
            if (HasCredentials)
                settings.DefaultCredentials = new MongoCredentials(this.Username, this.Password);

            return GetProvider().GetRepository(settings, database);
        }
Пример #6
0
        public static MongoServerSettings GetReplicaSetSettings(string roleName)
        {
            var settings = new MongoServerSettings();
            var replicaSetName = RoleEnvironment.GetConfigurationSettingValue(ReplicaSetNameSetting);
            settings.ReplicaSetName = replicaSetName;

            ReadOnlyCollection<RoleInstance> workerRoleInstances;
            try
            {
                workerRoleInstances = RoleEnvironment.Roles[roleName].Instances;
            }
            catch (KeyNotFoundException ke)
            {
                throw new Exception(
                    string.Format("The MongoDB role should be called {0}", roleName),
                    ke);
            }

            var servers = new List<MongoServerAddress>();
            foreach (var instance in workerRoleInstances)
            {
                var endpoint = AzureRoleHelper.GetEndPoint(instance, MongodPortKey);
                var server = new MongoServerAddress(endpoint.Address.ToString(), endpoint.Port);
                servers.Add(server);
            }

            settings.Servers = servers;
            settings.ConnectionMode = ConnectionMode.ReplicaSet;
            return settings;
        }
Пример #7
0
        public MongoConfig()
        {
            MongoConfigSection mongoSection = (MongoConfigSection)ConfigurationManager.GetSection(MongoConfigSection.DefaultSectionName);

            MongoServerSettings settings = new MongoServerSettings();
            MongoServerSettings reportingSettings = new MongoServerSettings();
            settings.ConnectionMode = mongoSection.ConnectionMode;
            settings.ReplicaSetName = mongoSection.ReplicaSetName;
            reportingSettings.ConnectionMode = mongoSection.ConnectionMode;
            reportingSettings.ReplicaSetName = mongoSection.ReplicaSetName;
            reportingSettings.SlaveOk = mongoSection.SlaveOk;

            if (mongoSection.ServerAddresses.Count == 0)
                throw new ConfigurationErrorsException("No server has been define in configuration");
            if (mongoSection.SlaveAddresses.Count == 0)
                throw new ConfigurationErrorsException("No server has been define in configuration");
            var servers = new List<MongoServerAddress>();
            foreach (ServerAddress serverAddr in mongoSection.ServerAddresses)
            {
                servers.Add(new MongoServerAddress(serverAddr.Server, serverAddr.Port));
            }
            settings.Servers = servers;
            var reportingServers = new List<MongoServerAddress>();
            foreach (SlaveAddress slaveAddr in mongoSection.SlaveAddresses)
            {
                reportingServers.Add(new MongoServerAddress(slaveAddr.Server, slaveAddr.Port));
            }
            reportingSettings.Servers = reportingServers;

            MongoServer = MongoServer.Create(settings);
            MongoDatabase = MongoServer.GetDatabase(mongoSection.Database, new MongoCredentials(mongoSection.UserName, mongoSection.Password, mongoSection.MongoAdmin));
            ReportingServer = MongoServer.Create(reportingSettings);
            ReportingDatabase = ReportingServer.GetDatabase(mongoSection.Database, new MongoCredentials(mongoSection.UserName, mongoSection.Password, mongoSection.MongoAdmin));
        }
        // constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="MongoServerInstance"/> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="address">The address.</param>
        internal MongoServerInstance(MongoServerSettings settings, MongoServerAddress address)
        {
            _settings = settings;
            _address = address;
            _sequentialId = Interlocked.Increment(ref __nextSequentialId);
            _state = MongoServerState.Disconnected;
            _serverInfo = new ServerInformation
            {
                MaxDocumentSize = MongoDefaults.MaxDocumentSize,
                MaxMessageLength = MongoDefaults.MaxMessageLength,
                InstanceType = MongoServerInstanceType.Unknown
            };
            _connectionPool = new MongoConnectionPool(this);
            _pingTimeAggregator = new PingTimeAggregator(5);
            _permanentlyDisconnected = false;
            // Console.WriteLine("MongoServerInstance[{0}]: {1}", sequentialId, address);

            _stateVerificationAcquireConnectionOptions = new MongoConnectionPool.AcquireConnectionOptions
            {
                OkToAvoidWaitingByCreatingNewConnection = false,
                OkToExceedMaxConnectionPoolSize = true,
                OkToExceedWaitQueueSize = true,
                WaitQueueTimeout = TimeSpan.FromSeconds(2)
            };
        }
        public void TestDefaults()
        {
            var settings = new MongoServerSettings();
            Assert.AreEqual(ConnectionMode.Direct, settings.ConnectionMode);
            Assert.AreEqual(MongoDefaults.ConnectTimeout, settings.ConnectTimeout);
            Assert.AreEqual(null, settings.DefaultCredentials);
            Assert.AreEqual(MongoDefaults.MaxConnectionIdleTime, settings.MaxConnectionIdleTime);
            Assert.AreEqual(MongoDefaults.MaxConnectionLifeTime, settings.MaxConnectionLifeTime);
            Assert.AreEqual(MongoDefaults.MaxConnectionPoolSize, settings.MaxConnectionPoolSize);
            Assert.AreEqual(MongoDefaults.MinConnectionPoolSize, settings.MinConnectionPoolSize);
            Assert.AreEqual(null, settings.ReplicaSetName);
            Assert.AreEqual(SafeMode.False, settings.SafeMode);
            Assert.AreEqual(null, settings.Server);
            Assert.AreEqual(null, settings.Servers);
            Assert.AreEqual(MongoDefaults.SocketTimeout, settings.SocketTimeout);
            Assert.AreEqual(MongoDefaults.ComputedWaitQueueSize, settings.WaitQueueSize);
            Assert.AreEqual(MongoDefaults.WaitQueueTimeout, settings.WaitQueueTimeout);

            Assert.IsFalse(settings.IsFrozen);
            var hashCode = settings.GetHashCode();
            var stringRepresentation = settings.ToString();
            Assert.AreEqual(settings, settings);

            settings.Freeze();
            Assert.IsTrue(settings.IsFrozen);
            Assert.AreEqual(hashCode, settings.GetHashCode());
            Assert.AreEqual(stringRepresentation, settings.ToString());
        }
        public MongoOptimisticDataStore(MongoServerSettings settings, string databaseName, string collectionName)
        {
            this.ServerSettings = settings;
            this.DatabaseName = databaseName;
            this.CollectionName = collectionName;

            this.IsConnected = false;
        }
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoServerInstance"/> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="address">The address.</param>
 /// <param name="cluster">The cluster.</param>
 internal MongoServerInstance(MongoServerSettings settings, MongoServerAddress address, ICluster cluster)
 {
     _settings = settings;
     _address = address;
     _cluster = cluster;
     _sequentialId = Interlocked.Increment(ref __nextSequentialId);
     _endPoint = new DnsEndPoint(address.Host, address.Port);
 }
Пример #12
0
		public MongoRepository(
			MongoServerSettings settings,
			string database)
		{
			_Server = new MongoServer(settings);
            _Database = database;
			_Server.Connect();
		}
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoServerInstance" /> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="address">The address.</param>
 /// <param name="cluster">The cluster.</param>
 /// <param name="endPoint">The end point.</param>
 internal MongoServerInstance(MongoServerSettings settings, MongoServerAddress address, ICluster cluster, EndPoint endPoint)
 {
     _settings = settings;
     _address = address;
     _cluster = cluster;
     _sequentialId = Interlocked.Increment(ref __nextSequentialId);
     _endPoint = endPoint;
 }
Пример #14
0
        public ActionResult JsonAction2()
        {
            var mongoServSettings = new MongoDB.Driver.MongoServerSettings();

            mongoServSettings.Server = new MongoDB.Driver.MongoServerAddress("localhost");

            var mongoServer = new MongoDB.Driver.MongoServer(mongoServSettings);

            mongoServer.Connect();

            var db = mongoServer.GetDatabase("monitera");

            var collection = db.GetCollection<db>("dbo.post");
            //collection.Insert(new db { gender = "m"});

            var pozitif = Query<db>.Where(f => f.sentimentid == 1);
            var notr = Query<db>.Where(f => f.sentimentid == 2);
            var negatif = Query<db>.Where(f => f.sentimentid == 3);
            var poznotr = Query<db>.Where(f => f.sentimentid == 4);
            var negnotr = Query<db>.Where(f => f.sentimentid == 5);

            var poz = collection.Count(pozitif);
            var no = collection.Count(notr);
            var ne = collection.Count(negatif);
            var pn = collection.Count(poznotr);
            var nn = collection.Count(negnotr);

            var oranlar = (new[]{
                                 new{
                                     Durum = "Pozitif",
                                     value = poz
                                 },

               new {
                Durum = "Nötr",
                value = no

            },
            new {
                Durum = "Negatif",
                value = ne

            },
            new {
                Durum = "Pozitif - Nötr",
                value = pn

            },
            new {
                Durum = "Negatif - Nötr",
                value = nn

            }
            }
            );

            return Json(oranlar, JsonRequestBehavior.AllowGet);
        }
 public DatabaseManager()
 {
     // Bouwt een connection string
     MongoServerSettings settings = new MongoServerSettings();
     settings.Server = new MongoServerAddress("145.24.222.160", 8010);
     // Maakt een MongoDB server object, met dit object kunnen we communiceren met de server. Het maakt kortom verbinding met de mongodb server
     MongoServer server = new MongoServer(settings);
     // Vraagt onze database op van de server, zodat we read/write kunnen toepassen
     database = server.GetDatabase("Dataflow");
 }
        public void TestApplicationName_too_long()
        {
            var subject = new MongoServerSettings();
            var value = new string('x', 129);

            var exception = Record.Exception(() => subject.ApplicationName = value);

            var argumentException = exception.Should().BeOfType<ArgumentException>().Subject;
            argumentException.ParamName.Should().Be("value");
        }
Пример #17
0
 /// <summary>
 /// Creates a new instance of MongoUrl.
 /// </summary>
 /// <param name="url">The URL containing the settings.</param>
 public MongoUrl(
     string url
 ) {
     var builder = new MongoUrlBuilder(url); // parses url
     serverSettings = builder.ToServerSettings().FrozenCopy();
     this.waitQueueMultiple = builder.WaitQueueMultiple;
     this.waitQueueSize = builder.WaitQueueSize;
     this.databaseName = builder.DatabaseName;
     this.url = builder.ToString(); // keep canonical form
 }
Пример #18
0
 public static MongoDatabase Db()
 {
     // Create server settings to pass connection string, timeout, etc.
     MongoServerSettings settings = new MongoServerSettings();
     settings.Server = new MongoServerAddress("localhost", 27017);
     // Create server object to communicate with our server
     MongoServer server = new MongoServer(settings);
     // Get our database instance to reach collections and data
     var database = server.GetDatabase("shouter");
     return database;
 }
Пример #19
0
 public void TestCreateMongoServerSettings()
 {
     var settings = new MongoServerSettings
     {
         Server = new MongoServerAddress("localhost"),
         SafeMode = SafeMode.True
     };
     var server1 = MongoServer.Create(settings);
     var server2 = MongoServer.Create(settings);
     Assert.AreSame(server1, server2);
     Assert.AreEqual(settings, server1.Settings);
 }
Пример #20
0
        public void NewBlockShouldBe1SpecificConstructor()
        {
            MongoServerSettings settings = new MongoServerSettings();
            settings.Server = new MongoServerAddress("localhost");

            MongoOptimisticDataStore ds = new MongoOptimisticDataStore(settings, "SnowMaker", "IntegrationTests");

            Assert.NotNull(ds);

            Guid blockName = Guid.NewGuid();

            Assert.AreEqual("1", ds.GetData(blockName.ToString()));
        }
        public void TestConnectTimeout()
        {
            var settings = new MongoServerSettings();
            Assert.AreEqual(MongoDefaults.ConnectTimeout, settings.ConnectTimeout);

            var connectTimeout = new TimeSpan(1, 2, 3);
            settings.ConnectTimeout = connectTimeout;
            Assert.AreEqual(connectTimeout, settings.ConnectTimeout);

            settings.Freeze();
            Assert.AreEqual(connectTimeout, settings.ConnectTimeout);
            Assert.Throws<InvalidOperationException>(() => { settings.ConnectTimeout = connectTimeout; });
        }
        public void TestConnectionMode()
        {
            var settings = new MongoServerSettings();
            Assert.AreEqual(ConnectionMode.Automatic, settings.ConnectionMode);

            var connectionMode = ConnectionMode.Direct;
            settings.ConnectionMode = connectionMode;
            Assert.AreEqual(connectionMode, settings.ConnectionMode);

            settings.Freeze();
            Assert.AreEqual(connectionMode, settings.ConnectionMode);
            Assert.Throws<InvalidOperationException>(() => { settings.ConnectionMode = connectionMode; });
        }
        public void TestCreateMongoServerSettings()
        {
            var settings = new MongoServerSettings
            {
                Server = new MongoServerAddress("localhost"),
            };
#pragma warning disable 618
            var server1 = MongoServer.Create(settings);
            var server2 = MongoServer.Create(settings);
#pragma warning restore 618
            Assert.AreSame(server1, server2);
            Assert.AreEqual(settings, server1.Settings);
        }
        public void TestApplicationName()
        {
            var settings = new MongoServerSettings();
            Assert.Equal(null, settings.ApplicationName);

            var applicationName = "app2";
            settings.ApplicationName = applicationName;
            Assert.Equal(applicationName, settings.ApplicationName);

            settings.Freeze();
            Assert.Equal(applicationName, settings.ApplicationName);
            Assert.Throws<InvalidOperationException>(() => { settings.ApplicationName = applicationName; });
        }
Пример #25
0
        public MongoConfig()
        {
            MongoConfigSection mongoSection = (MongoConfigSection)ConfigurationManager.GetSection(MongoConfigSection.DefaultSectionName);

            MongoServerSettings settings = new MongoServerSettings();
            settings.ConnectionMode = ConnectionMode.Direct;
            settings.Server = new MongoServerAddress(mongoSection.Host, mongoSection.Port);
            MongoCredentials credential = new MongoCredentials(mongoSection.UserName, mongoSection.Password);
            settings.DefaultCredentials = credential;
            settings.SafeMode = SafeMode.True;
            settings.SlaveOk = true;
            MongoServer mongoSvr = MongoServer.Create(settings);
            MongoDatabase = mongoSvr.GetDatabase(mongoSection.Database);
        }
Пример #26
0
        public MongoDatabase GetDB()
        {
            MongoServerAddress address = new MongoServerAddress("127.0.0.1", 27017);

            MongoServerSettings settings = new MongoServerSettings();

            settings.Server = address;

            MongoServer server = new MongoServer(settings);

            MongoDatabase myDB = server.GetDatabase("MyDB");

            return myDB;
        }
        public void TestAll()
        {
            var settings = new MongoServerSettings();
            settings.ConnectionMode = ConnectionMode.ReplicaSet;
            settings.ConnectTimeout = TimeSpan.FromSeconds(1);
            settings.DefaultCredentials = MongoCredentials.Create("username", "password");
            settings.GuidRepresentation = GuidRepresentation.CSharpLegacy;
            settings.IPv6 = true;
            settings.MaxConnectionIdleTime = TimeSpan.FromSeconds(2);
            settings.MaxConnectionLifeTime = TimeSpan.FromSeconds(3);
            settings.MaxConnectionPoolSize = 99;
            settings.MinConnectionPoolSize = 11;
            settings.ReadPreference = ReadPreference.Primary;
            settings.ReplicaSetName = "replicaname";
            settings.SafeMode = SafeMode.Create(5, TimeSpan.FromSeconds(4));
            settings.Server = new MongoServerAddress("server");
            settings.SocketTimeout = TimeSpan.FromSeconds(5);
            settings.UseSsl = true;
            settings.WaitQueueSize = 55;
            settings.WaitQueueTimeout = TimeSpan.FromSeconds(6);

            Assert.AreEqual(ConnectionMode.ReplicaSet, settings.ConnectionMode);
            Assert.AreEqual(TimeSpan.FromSeconds(1), settings.ConnectTimeout);
            Assert.AreEqual(MongoCredentials.Create("username", "password"), settings.DefaultCredentials);
            Assert.AreEqual(GuidRepresentation.CSharpLegacy, settings.GuidRepresentation);
            Assert.AreEqual(true, settings.IPv6);
            Assert.AreEqual(TimeSpan.FromSeconds(2), settings.MaxConnectionIdleTime);
            Assert.AreEqual(TimeSpan.FromSeconds(3), settings.MaxConnectionLifeTime);
            Assert.AreEqual(99, settings.MaxConnectionPoolSize);
            Assert.AreEqual(11, settings.MinConnectionPoolSize);
            Assert.AreEqual(ReadPreference.Primary, settings.ReadPreference);
            Assert.AreEqual("replicaname", settings.ReplicaSetName);
            Assert.AreEqual(SafeMode.Create(5, TimeSpan.FromSeconds(4)), settings.SafeMode);
            Assert.AreEqual(new MongoServerAddress("server"), settings.Server);
            Assert.IsTrue((new[] { new MongoServerAddress("server") }).SequenceEqual(settings.Servers));
            Assert.AreEqual(TimeSpan.FromSeconds(5), settings.SocketTimeout);
            Assert.AreEqual(true, settings.UseSsl);
            Assert.AreEqual(55, settings.WaitQueueSize);
            Assert.AreEqual(TimeSpan.FromSeconds(6), settings.WaitQueueTimeout);

            Assert.IsFalse(settings.IsFrozen);
            var hashCode = settings.GetHashCode();
            var stringRepresentation = settings.ToString();
            Assert.AreEqual(settings, settings);

            settings.Freeze();
            Assert.IsTrue(settings.IsFrozen);
            Assert.AreEqual(hashCode, settings.GetHashCode());
            Assert.AreEqual(stringRepresentation, settings.ToString());
        }
        public void TestCreateMongoServerSettings()
        {
#pragma warning disable 618
            var settings = new MongoServerSettings
            {
                Server = new MongoServerAddress("localhost74883190"),
                SafeMode = SafeMode.True
            };
            var server1 = MongoServer.Create(settings);
            var server2 = MongoServer.Create(settings);
            Assert.AreNotSame(server1, server2);
            Assert.AreEqual(server1.SequentialId, server2.SequentialId); // same proxy
            Assert.AreEqual(settings, server1.Settings);
#pragma warning restore
        }
Пример #29
0
        private void InstallMongoDBEventStore()
        {
            MongoServerSettings settings = new MongoServerSettings();
            settings.ConnectionMode = ConnectionMode.ReplicaSet;
            settings.ReplicaSetName = "dokukuSet";
            settings.DefaultCredentials = new MongoCredentials("admin", "S31panas", true);
            settings.SlaveOk = true;
            settings.Servers = new List<MongoServerAddress>
            {
                new MongoServerAddress("tcloud2.bonastoco.com", 27021),
                new MongoServerAddress("tcloud2.bonastoco.com", 27022)
            };
            MongoServer mongo = MongoServer.Create(settings);

            NcqrsEnvironment.SetDefault<IEventStore>(new MongoDBEventStore(mongo, SafeMode.True, "Payment"));
        }
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoServerInstance"/> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="address">The address.</param>
 internal MongoServerInstance(MongoServerSettings settings, MongoServerAddress address)
 {
     _settings = settings;
     _address = address;
     _sequentialId = Interlocked.Increment(ref __nextSequentialId);
     _state = MongoServerState.Disconnected;
     _serverInfo = new ServerInformation
     {
         MaxDocumentSize = MongoDefaults.MaxDocumentSize,
         MaxMessageLength = MongoDefaults.MaxMessageLength,
         InstanceType = MongoServerInstanceType.Unknown
     };
     _connectionPool = new MongoConnectionPool(this);
     _pingTimeAggregator = new PingTimeAggregator(5);
     _permanentlyDisconnected = false;
     // Console.WriteLine("MongoServerInstance[{0}]: {1}", sequentialId, address);
 }