Fixed CSHARP-268. Added locking to MongoServerInstance to make it thread safe. Simplified locking in MongoServer by using just one lock (multiple locks were confusing and had the potential for deadlock).
This reverts commit cc86db54b6d15cbc89b15ef1481d70d92bc511e4.
The previous commit had a deadlock problem. Reverting previous commit while the problem gets resolved.
Second attempt at CSHARP-268. Since MongoServer state changes in response to events raised on multiple threads (when using replica sets) we need a second lower level stateLock to synchronize state changes. Note to self: be careful with commits after 1am...
Changed when MongoServerInstances are created. They are now created as soon as MongoServer is created (with a State of Disconnected). For a direct connection, a single MongoServerInstance is created. For a replica set, a MongoServerInstance is created for each server on the seed list, and the set is adjusted as necessary when we actually connect to the replica set. This change means that the Instances property is never null, so client code doesn't have to special case for null.
Wrestling with replica set failover. Probably still needs more testing. Added waitFor parameter to Connect to specify what to wait for when connecting to a replica set. Added connectionAttempt counter to MongoServer. Changed how current primary is tracked in MongoServer. Added new ConnectedToSubset value to MongoServerState.
Fixed CSHARP-293. Added additional information to the error message when the same element name is used more than once in a class map.
Implemented CSHARP-202 (see ConnectWaitFor added in earlier commit). This commit improves error messages when Connect fails (for both DirectConnector and ReplicaSetConnector).
Fixed CSHARP-297. Implemented IsCapped method on MongoDB.Driver.MongoCollection and added Capped property to MongoDB.Driver.CollectionStatsResult. MongoCollectionTests updated with an online test.
Merged CSHARP-297 pull request from Brian Knight with minor tweak. Added additional unit test.
Fixed CSHARP-290. Added back the IDictionary<string, object> overloads, but also added Dictionary<string, object> overloads to resolve the ambiguity when passing a Dictionary<string, object> value as an argument. Less common ambiguities (with classes like SortedDictionary and SortedList) still have to be resolved by the user with a cast.
Further work on CSHARP-283. Added BsonArray overloads to resolve ambiguity of BsonArray arguments with IEnumerable<BsonValue> and params BsonValue[] overloads. Improved doc comments for Query and Update builders.
Implemented CSHARP-295. SetMaxDocuments now takes a long. Added some unit tests.
Implemented CSHARP-299. Added QueryResult property to MongoQueryException. Couldn't figure out an easy way to unit test this (how do you make a query fail?).
Implemented CSHARP-292. The static method Update.Combine combines a variable number of UpdateBuilders into one single new UpdateBuilder. The instance method UpdateBuilder.Combine combines one other UpdateBuilder into an existing UpdateBuilder.
Fixed CSHARP-263. Changed BsonBaseSerializer to require that all subclasses implement the overload of Deserialize that inludes an actualType parameter. When an array is serialized and nominalType is object it now wraps the array in a document that includes type information ("_t" and "_v" elements).
Partial fix for CSHARP-302. The default action now when there is an exception on a connection is to discard only that connection instead of the whole connection pool, preventing a Connect/Disconnect storm. Also made Disconnect synchronous so it should no longer be possible to open new connections faster than old ones are being closed.
When Ping is called and MongoServer is connected to a replica set, Ping now pings all members of the replica set one at a time, instead of just the Primary. Also added a Ping method to MongoServerInstance, so individual instances can be pinged if desired.
New implementation for CSHARP-216 that avoids ambiguities between overloads.
Forgot to add two new files before previous commit.
Fixed CSHARP-306. Index on fs.chunks is now unique.