39 Commits (3108b605a9a877c829dfcbaaae3cf52866b245fe)

Author SHA1 Message Date
rstam 3108b605a9 Only set SlaveOk to false in CommandCollectionSettings if ConnectionMode is ReplicaSet. GetServerInstance just returns the one and only instance unless ConnectionMode is ReplicaSet. 14 years ago
rstam ddc1db0829 Refactored how GuidByteOrder is configured and handled. Instead of allowing it to be configured at the individual property level (which was a pain), it is now configured at the server, database and collection levels. This introduces the restriction that all Guids in the same collection must use the same GuidByteOrder, but this restriction should actually help keep things sane and manageable. 14 years ago
rstam 654277eb7e Implemented CSHARP-235. MongoDatabase.DropCollection and MongoCollection.Drop no longer throw an exception if the collection does not exist. If the caller needs to know whether the collection actually existed they can examine the Ok property of the CommandResult (or call MongoDatabase.CollectionExists or MongoCollection.Exists beforehand). 14 years ago
rstam 89251fcf16 Worked on the wording of more exception messages, this time in the Driver project. 14 years ago
rstam f81093352d Fixed CSHARP-230. Dropping a collection now resets the cache used by EnsureIndex to keep track of which indexes have already been created. 14 years ago
rstam 8817cbcadb Minor cleanup of recent changes. 14 years ago
rstam 8621613efe Partial work on CSHARP-212. Added Powershell friendly versions of generic methods in MongoCollection, MongoCursor, MongoDatabase and MongoServer as well as related helper classes. 14 years ago
rstam 6f9e959f54 Second round of namespace refactoring. Removed the MongoDB.Bson.DefaultSerializer namespace and moved everything from it into the MongoDB.Bson.Serialization namespace or one of its child namespaces (Attributes, Conventions or Options). The goal here is to unify serialization under the MongoDB.Bson.Serialization namespace and that the most common uses of serialization require only a single using statement for the top level namespace. A secondary goal is to organize the namespace hierarchy a little better as presented in the help file. 15 years ago
rstam 1d6e9a9c0c Added Freeze method to BsonBinaryReaderSettings, BsonBinaryWriterSettings and JsonWriterSettings. Made small changes throughout so that Freeze method is used consistently. 15 years ago
rstam b0e5be74b2 Added IMongoCollectionOptions, CollectionOptionsDocument, CollectionOptionsWrapper and CollectionOptionsBuilder. 15 years ago
rstam 22029f34ab Revised doc comments for MongoServer. Added first draft of doc comments for MongoDatabase. 15 years ago
rstam 36301f207a First draft of doc comments for MongoServer. 15 years ago
rstam a1ee94f894 Moved MongoGridFS.DefaultSettings to MongoGridFSSettings.Defaults to be consistent with how other defaults are handled. Renamed DefaultChunkSize to ChunkSize. 15 years ago
rstam 6aebe9aae7 Moved IndexCache used by EnsureIndex from MongoCollection to MongoServer so that all instances of MongoCollection share a common IndexCache. 15 years ago
rstam 892ca7f7f0 Made MongoCollectionSettings abstract and created concrete MongoCollectionSettings<TDefaultDocument> subclass. 15 years ago
rstam aba7013906 Implemented CSHARP-89. Made public properties and methods of MongoServer, MongoDatabase, MongoCollection and MongoCursor virtual to enable the use of mock object unit testing frameworks. 15 years ago
rstam b3099d4edf Made SlaveOk configurable at all levels (server, database, collection and cursor). Moved MongoCursorEnumerator from a nested class in MongoCursor to the Internal folder. CommandCollection now uses SlaveOk set to false to route commands to the primary instead of creating a new instance of MongoServer. 15 years ago
rstam b552f5e394 Updated copyright notices. 15 years ago
rstam f7212cc229 Added MongoServerSettings, MongoDatabaseSettings and MongoCollectionSettings. Not only does this unify how settings are handled at the various levels, it also finally made MongoCollection thread safe as claimed (by incorporating AssignIdOnInsert into the settings) and paves the way for making SlaveOk configurable at all 4 levels soon. 15 years ago
rstam 4858726a4c Implemented changes suggested in CSHARP-135. MongoCommandException error messages now include the command result in JSON format. Also added a CommandResult property to MongoCommandException and a Command property to MongoCommandResult. MongoSafeModeException is now a subclass of MongoCommandException. 15 years ago
rstam c89233a037 CommandResult now wraps a BsonDocument instead of subclassing it. One clue that it shouldn't have subclassed it was that when using a CommandResult Intellisense was showing all the irrelevant BsonDocument methods. Now Intellisense will only show the properties and methods relevant to CommandResult. The original BsonDocument command response is available via the new Response property. 15 years ago
rstam d0c5b9645b Implemented CSHARP-109. Replaced many unconstrained type parameters with marker interfaces to increase compile time type safety. Note that the unit tests required almost no changes to compile and pass. 15 years ago
rstam 6e8225f58c Fixed CSHARP-118. For now the fix is a bit brute force: all commands are routed to the primary (in the future we might detect which commands have to be routed to the primary and which are OK to send to secondaries). 15 years ago
rstam 2f7b2be799 Added a few convenience methods. 15 years ago
rstam 22373158c5 Partial implementation of MongoGridFSStream (just two unit tests, but they pass... more work to do). 15 years ago
rstam 1418584fa5 Moved default GridFS settings to MongoGridFS. Added Freeze and IsFrozen to MongoGridFSSettings. Moved SafeMode from MongoGridFS to MongoGridFSSettings. 15 years ago
rstam a9a13ba835 Redid RunCommand and RunAdminCommand along the lines of Find and FindAs, so added RunCommandAs and RunAdminCommandAs where the "As" suffix indicates the presence of a generic type parameter that specifies the type that the command result should be returned "as" (I realize the "As" suffix isn't exactly grammatical, but at least it's consistent with FindAs). Also removed method overloads that took an adminCredentials parameter (there were just too many overloads of some methods, if you need admin credentials then those commands just have to be performed using a server instance that has admin credentials). 15 years ago
rstam cd2bb0668a Removed GetConnection and ReleaseConnection from MongoDatabase (they just forwarded to MongoServer so callers now just call MongoServer directly). Added handling of "not master" error for replica set failover. Renamed HandleSocketException to HandleException in MongoConnection and now handle more exception types for replica set failover. 15 years ago
rstam efb52b962e Minor changes. 15 years ago
rstam 6df664f804 Added a new CommandResult class that is derived from BsonDocument. It adds Ok and ErrorMessage properties that decode the command result in a typesafe way. Also added several CommandResult subclasses (stubbed for now) that will have many typesafe properties and methods to pick apart the results of various complex commands. 15 years ago
rstam 14c97e4545 Fixed CSHARP-103. ReleaseConnection in MongoDatabase was calling ReleaseConnection in MongoConnectionPool when it should have been calling ReleaseConnection in MongoServer. 15 years ago
rstam ca90c768f3 Moved GetConnection, GetLastError, ReleaseConnection, RequestNestingLevel, RequestStart and RequestDone to MongoServer. Replaced connectionPool in MongoServer with primaryConnectionPool and secondaryConnectionPools (MongoServer now handles multiple connection pools when connecting to a replica set with slaveOk true). GetConnection and GetConnectionPool methods now take a slaveOk parameter. GetConnection in MongoServer distributes reads to replica set secondaries when slaveOk is true. ReplicaSetConnector now connects to all secondaries when slaveOk is true (if not it stops as soon as the primary is found). 15 years ago
rstam 39853b46ca SafeMode is now readonly in MongoDatabase and MongoCollection (required for thread safety). SafeMode value is set when object is created. 15 years ago
rstam aca61ac568 The AdminCredentials, DefaultCredentials, SafeMode and SlaveOk properties of MongoServer are now read only (this is important because otherwise threads sharing a MongoServer instance could experience unexpected behavior). Admin commands now have an overload with an adminCredentials parameter. 15 years ago
rstam b6bb2d3bbf MongoUrl is now immutable. Added MongoUrlBuilder. Removed MongoConnectionSettings (replaced by immutable MongoUrl). MongoUrl is now identity of MongoServer objects. Cache MongoUrls to avoid repeating URL parsing. 15 years ago
rstam 4dcf112627 Replaced FetchAs with FetchDBRef and FetchDBRefAs. 15 years ago
rstam 6315e5203f Fixed CSHARP-88. All methods in MongoDatabase take and return plain collection names (not full collection names prefixed with the database name). Moved RenameCollection method from MongoServer to MongoDatabase. 15 years ago
rstam 668110faf6 Added initial version of DriverOnlineTests project. These tests differ from the tests in DriverUnitTests because they connect to localhost to test against a live database. 15 years ago
rstam 3900d3f0db Renamed MongoDB.BsonLibrary namespace to MongoDB.Bson and MongoDB.CSharpDriver to MongoDB.Driver (Library was redundant and VB users might not want to see CSharp in the namespace). Renamed Bson static class BsonConstants (because it a class can't have the same name as the namespace it is in). 15 years ago
rstam 3082b0f11a Implemented MongoDBRef class and FetchAs methods in MongoServer and MongoDatabase. Unit tests to follow in a new solution (CSharpDriverLocalhostTests). 15 years ago
Justin Dearing ed6a312500 Allow mixed case database names. Use more detailed error messages describing why a database name is invalid. [Patch submitted by Justin Dearing]. 15 years ago
rstam 338c5d1cf8 Use "getlasterrror" all lowercase for backward compatibility with older servers. 15 years ago
rstam 1eb76fdc92 Renamed TResult to TDocument and TResultDefault to TDefaultDocument (they read much better). 15 years ago
rstam b114d8ee45 The recommended naming convention for type names in generic classes and methods is "T" followed by a descriptive word. Accordingly, renamed C to TCommand, D to TResultDefault, F to TFields, I to TDocument, K to TIndexKeys or TGroupBy, O to TIndexOptions or TMapReduceOptions, Q to TQuery, R to TResult, RNew to TResultNew, S to TScope or TSortBy, T to TDocument, U to TUpdate. 15 years ago
rstam 1a17901f3e Removed "where T : new()" type constraint from generic classes and methods. 15 years ago
rstam e790cc3c87 Replaced MongoException with ArgumentException, FileFormatException, FileNotFoundException, InvalidOperationException, MongoAuthenticationException, MongoCommandException, MongoConnectionException, MongoGridFSException, MongoInternalException, MongoQueryFailureException or MongoSafeModeException as appropriate. 15 years ago
rstam 8d4557de52 Created some new folders to organize source files better. 15 years ago
rstam 4e5e7b778d Added BuilderBase to share methods among all builders. Removed fields argument from any overloads of Find, FindAll and FindOne (to avoid conflicts between overloads; use Fields fluent interface on MongoCursor instead). Modified all methods that take a query parameter to be generic on the query type <Q> so that any document that can ultimately be serialized to BSON can serve as a query object. Modified FieldsBuilder to be a subclass of BuilderBase and to implement IBsonSerializable (so now it doesn't have to be converted to a BsonDocument first to be serialized). Added serializeIdFirst parameter to Serialize methods and calls to it. Removed overloads of Find and FindOne that took a BsonJavaScript parameter to avoid overload resolution conflicts in light of the new generic overloads (use Query.where instead). 15 years ago
rstam cc2786a9b5 Reviewed API for cases where we should be using IEnumerable<T> instead of List<T>. Split overloads of Insert in MongoCollection into Insert and InsertBatch and reduced the number of overloads to resolve severe problems the compiler was having with inferring the wrong type for <I>. Added a no-argument Create method to MongoServer which defaults to localhost. 15 years ago
rstam a62fddf18e Finalized DLL filenames and source code namespaces for release. 15 years ago