diff --git a/examples/Simple/Main.cs b/examples/Simple/Main.cs index aefdbd2b..cab5d1c5 100644 --- a/examples/Simple/Main.cs +++ b/examples/Simple/Main.cs @@ -1,100 +1,101 @@ using System; using System.Configuration; - using MongoDB; namespace Simple { /// - /// Illustrates some simple operations on the database. - /// Creating a database connection. - /// Remove some documents. - /// Insert some documents - /// Find one document - /// Find several documents and iterate through them. + /// Illustrates some simple operations on the database. + /// Creating a database connection. + /// Remove some documents. + /// Insert some documents + /// Find one document + /// Find several documents and iterate through them. /// - class MainClass + internal class MainClass { - Mongo mongo; - IMongoDatabase simple; - IMongoCollection categories; - - public static void Main (string[] args){ - MainClass main = new MainClass(); + private IMongoCollection categories; + private Mongo mongo; + private IMongoDatabase simple; + + public static void Main(string[] args) + { + var main = new MainClass(); main.Setup(); main.Run(); } - /// - /// Setup the collection and insert some data into it. + /// Setup the collection and insert some data into it. /// - public void Setup(){ - string connstr = ConfigurationManager.AppSettings["simple"]; - if(String.IsNullOrEmpty(connstr)) throw new ArgumentNullException("Connection string not found."); + public void Setup() + { + var connstr = ConfigurationManager.AppSettings["simple"]; + if(String.IsNullOrEmpty(connstr)) + throw new ArgumentNullException("Connection string not found."); mongo = new Mongo(connstr); mongo.Connect(); simple = mongo["simple"]; categories = simple["categories"]; - Clean(); - - var names = new string[]{"Bluez", "Jazz", "Classical", "Rock", "Oldies", "Heavy Metal"}; - foreach(string name in names){ - categories.Insert(new Document(){{"name", name}}); - } + Clean(); + + var names = new[] {"Bluez", "Jazz", "Classical", "Rock", "Oldies", "Heavy Metal"}; + foreach(var name in names) + categories.Insert(new Document {{"name", name}}); } - - public void Clean(){ - categories.Delete(new Document(){{"name", "Jazz"}}); //remove documents with the name Jazz. - categories.Delete(new Document()); //remove everything from the categories collection. + + public void Clean() + { + categories.Remove(new Document {{"name", "Jazz"}}); //remove documents with the name Jazz. + categories.Remove(new Document()); //remove everything from the categories collection. } - - public void Run(){ - var category = categories.FindOne(new Document { { "name", "Bluez" } }); - - Console.WriteLine ("The id findOne" + category["_id"]); - - Document selector = new Document(){{"_id", category["_id"]}}; - - category["name"] = "Bluess"; + + public void Run() + { + var category = categories.FindOne(new Document {{"name", "Bluez"}}); + + Console.WriteLine("The id findOne" + category["_id"]); + + var selector = new Document {{"_id", category["_id"]}}; + + category["name"] = "Bluess"; //The following will do the same thing. categories.Save(category); - - Console.WriteLine("Category after one update " + categories.FindOne(selector).ToString()); - + + Console.WriteLine("Category after one update " + categories.FindOne(selector)); + category["name"] = "Blues"; categories.Update(category, selector); - - Console.WriteLine("Category after two updates " + categories.FindOne(selector).ToString()); - + + Console.WriteLine("Category after two updates " + categories.FindOne(selector)); + //Find it by _id that has been converted to a string now. - string id = ((Oid)category["_id"]).ToString(); - + var id = (category["_id"]).ToString(); + Console.WriteLine("Found by string id converted back to Oid"); - Console.WriteLine(categories.FindOne(new Document(){{"_id", id.ToOid()}})); + Console.WriteLine(categories.FindOne(new Document {{"_id", id.ToOid()}})); //Find(new Document()) is equivalent to FindAll(); //Specifying the cursor in a using block will close it on the server if we decide not //to iterate through the whole thing. - using(ICursor all = categories.Find(new Document())) + using(var all = categories.Find(new Document())) { - foreach(Document doc in all.Documents){ + foreach(var doc in all.Documents) Console.WriteLine(doc.ToString()); - } } - + mongo.Disconnect(); } - } } public static class OidExtensions { - public static Oid ToOid (this string str){ - if (str.Length == 24) - return new Oid (str); - - return new Oid (str.Replace ("\"", "")); + public static Oid ToOid(this string str) + { + if(str.Length == 24) + return new Oid(str); + + return new Oid(str.Replace("\"", "")); } -} +} \ No newline at end of file diff --git a/examples/SimpleVB/Application.vb b/examples/SimpleVB/Application.vb index 52b355b9..557f93a5 100644 --- a/examples/SimpleVB/Application.vb +++ b/examples/SimpleVB/Application.vb @@ -48,8 +48,8 @@ Namespace Simple End Sub Public Sub Clean() - categories.Delete(New Document().Add("name", "Jazz")) 'remove documents with the name Jazz. - categories.Delete(new Document()) 'remove everything from the categories collection. + categories.Remove(New Document().Add("name", "Jazz")) 'remove documents with the name Jazz. + categories.Remove(New Document()) 'remove everything from the categories collection. End Sub Public Sub Run() Dim category As Document = categories.FindOne(New Document().Add("name", "Bluez")) diff --git a/source/MongoDB.GridFS/MongoDB.GridFS.csproj b/source/MongoDB.GridFS/MongoDB.GridFS.csproj index 23d8ad7c..9ed33f32 100644 --- a/source/MongoDB.GridFS/MongoDB.GridFS.csproj +++ b/source/MongoDB.GridFS/MongoDB.GridFS.csproj @@ -45,6 +45,7 @@ false bin\Debug\MongoDB.GridFS.xml AllRules.ruleset + 618 none diff --git a/source/MongoDB/DatabaseJavascript.cs b/source/MongoDB/DatabaseJavascript.cs index a41f69ca..94f45aa2 100644 --- a/source/MongoDB/DatabaseJavascript.cs +++ b/source/MongoDB/DatabaseJavascript.cs @@ -54,7 +54,7 @@ public void Add(Document item) /// public void Clear() { - _collection.Delete(new Document()); + _collection.Remove(new Document()); } /// @@ -257,7 +257,7 @@ public void Update(Document item) /// public bool Remove(string name) { - _collection.Delete(new Document().Add("_id", name)); + _collection.Remove(new Document().Add("_id", name)); return true; } } diff --git a/source/MongoDB/DatabaseMetadata.cs b/source/MongoDB/DatabaseMetadata.cs index 14fde3fe..b70f29cd 100644 --- a/source/MongoDB/DatabaseMetadata.cs +++ b/source/MongoDB/DatabaseMetadata.cs @@ -106,7 +106,7 @@ public void AddUser(string username, string password) public void RemoveUser(string username) { var users = _database["system.users"]; - users.Delete(new Document().Add("user", username)); + users.Remove(new Document().Add("user", username)); } /// diff --git a/source/MongoDB/IMongoCollection_1.cs b/source/MongoDB/IMongoCollection_1.cs index e15ce941..d8dd2f86 100644 --- a/source/MongoDB/IMongoCollection_1.cs +++ b/source/MongoDB/IMongoCollection_1.cs @@ -4,133 +4,144 @@ namespace MongoDB { /// - /// A collection is a storage unit for a group of s. The documents do not all have to - /// contain the same schema but for efficiency they should all be similar. + /// A collection is a storage unit for a group of s. The documents do not all have to + /// contain the same schema but for efficiency they should all be similar. /// - /// Safemode checks the database for any errors that may have occurred during - /// the insert such as a duplicate key constraint violation. - public interface IMongoCollection where T : class + /// + /// Safemode checks the database for any errors that may have occurred during + /// the insert such as a duplicate key constraint violation. + /// + public interface IMongoCollection + where T : class { /// - /// Gets the database. + /// Gets the database. /// /// The database. IMongoDatabase Database { get; } /// - /// Name of the collection. + /// Name of the collection. /// string Name { get; } /// - /// String value of the database name. + /// String value of the database name. /// string DatabaseName { get; } /// - /// Full name of the collection databasename . collectionname + /// Full name of the collection databasename . collectionname /// string FullName { get; } /// - /// Metadata about the collection such as indexes. + /// Metadata about the collection such as indexes. /// CollectionMetadata MetaData { get; } /// - /// Finds and returns the first document in a query. + /// Finds and returns the first document in a selector query. /// - /// A representing the query. + /// The selector. /// - /// A from the collection. + /// A from the collection. /// - T FindOne(object spec); + T FindOne(object selector); /// - /// Returns a cursor that contains all of the documents in the collection. + /// Returns a cursor that contains all of the documents in the collection. /// - /// Cursors load documents from the database in batches instead of all at once. + /// + /// Cursors load documents from the database in batches instead of all at once. + /// ICursor FindAll(); /// - /// Uses the $where operator to query the collection. The value of the where is Javascript that will - /// produce a true for the documents that match the criteria. + /// Uses the $where operator to query the collection. The value of the where is Javascript that will + /// produce a true for the documents that match the criteria. /// /// Javascript ICursor Find(string where); /// - /// Queries the collection using the specification. + /// Queries the collection using the query selector. /// - /// The spec. - /// - /// A - /// - ICursor Find(object spec); - + /// The selector. + /// A + ICursor Find(object selector); + /// - /// Queries the collection using the specification and only returns a subset of fields - /// from the . + /// Queries the collection using the specification and only returns a subset of fields. /// - /// - /// A - /// - ICursor Find(object spec, object fields); + /// The selector. + /// The fields. + /// A + ICursor Find(object selector, object fields); /// /// Deprecated. Use the fluent interface on the cursor to specify a limit and skip value. /// + /// The selector. + /// The limit. + /// The skip. + /// [Obsolete("Use the fluent interface on ICursor for specifying limit and skip Find.Skip(x).Limit(y)")] - ICursor Find(object spec, int limit, int skip); + ICursor Find(object selector, int limit, int skip); /// - /// Queries the collection using the specification and only returns a subset of fields + /// Queries the collection using the specification and only returns a subset of fields /// + /// The selector. + /// The limit. + /// The skip. + /// The fields. + /// [Obsolete("Use the fluent interface on ICursor for specifying limit and skip Find.Skip(x).Limit(y)")] - ICursor Find(object spec, int limit, int skip, object fields); + ICursor Find(object selector, int limit, int skip, object fields); /// /// Executes a query and atomically applies a modifier operation to the first document returning the original document /// by default. /// /// The document. - /// to find the document. + /// The selector. /// A - T FindAndModify(object document, object spec); + T FindAndModify(object document, object selector); /// /// Executes a query and atomically applies a modifier operation to the first document returning the original document /// by default. /// /// The document. - /// to find the document. + /// The selector. /// containing the names of columns to sort on with the values being the /// A /// - T FindAndModify(object document, object spec, object sort); + T FindAndModify(object document, object selector, object sort); /// /// Executes a query and atomically applies a modifier operation to the first document returning the original document /// by default. /// /// The document. - /// to find the document. + /// The selector. /// if set to true [return new]. /// A - T FindAndModify(object document, object spec, bool returnNew); + T FindAndModify(object document, object selector, bool returnNew); /// /// Executes a query and atomically applies a modifier operation to the first document returning the original document /// by default. /// /// The document. - /// to find the document. + /// The selector. /// containing the names of columns to sort on with the values being the /// /// if set to true [return new]. /// A - T FindAndModify(object document, object spec, object sort, bool returnNew); - + T FindAndModify(object document, object selector, object sort, bool returnNew); + /// /// Entrypoint into executing a map/reduce query against the collection. /// @@ -138,7 +149,7 @@ public interface IMongoCollection where T : class MapReduce MapReduce(); /// - /// Provides a fluent interface into building a map reduce command against the database. + /// Provides a fluent interface into building a map reduce command against the database. /// /// MapReduceBuilder MapReduceBuilder(); @@ -149,13 +160,14 @@ public interface IMongoCollection where T : class long Count(); /// - /// Count all items in a collection that match the query spec. + /// Count all items in a collection that match the query selector. /// - /// The spec. + /// The selector. + /// /// /// It will return 0 if the collection doesn't exist yet. /// - long Count(object spec); + long Count(object selector); /// /// Inserts the Document into the collection. @@ -169,90 +181,120 @@ public interface IMongoCollection where T : class void Insert(object document); /// - /// Bulk inserts the specified documents into the database. + /// Bulk inserts the specified documents into the database. /// - /// See the safemode description in the class description + /// + /// See the safemode description in the class description + /// void Insert(IEnumerable documents, bool safemode); /// - /// Bulk inserts the specified documents into the database. + /// Bulk inserts the specified documents into the database. /// /// The documents. void Insert(IEnumerable documents); /// - /// Deletes documents from the collection according to the spec. + /// Deletes documents from the collection according to the selector. /// - /// The selector. - /// if set to true [safemode]. + /// The selector. + /// if set to true [safemode]. /// - /// An empty document will match all documents in the collection and effectively truncate it. - /// See the safemode description in the class description + /// An empty document will match all documents in the collection and effectively truncate it. + /// See the safemode description in the class description /// + [Obsolete("Use Remove instead")] void Delete(object selector, bool safemode); /// - /// Deletes documents from the collection according to the spec. + /// Remove documents from the collection according to the selector. /// /// The selector. + /// if set to true [safemode]. /// /// An empty document will match all documents in the collection and effectively truncate it. + /// See the safemode description in the class description /// + void Remove(object selector, bool safemode); + + /// + /// Deletes documents from the collection according to the selector. + /// + /// The selector. + /// + /// An empty document will match all documents in the collection and effectively truncate it. + /// + [Obsolete("Use Remove instead")] void Delete(object selector); /// - /// Inserts or updates a document in the database. If the document does not contain an _id one will be - /// generated and an upsert sent. Otherwise the document matching the _id of the document will be updated. + /// Remove documents from the collection according to the selector. /// - /// The document. - /// if set to true [safemode]. - /// See the safemode description in the class description + /// The selector. + /// + /// An empty document will match all documents in the collection and effectively truncate it. + /// + void Remove(object selector); + + /// + /// Inserts or updates a document in the database. If the document does not contain an _id one will be + /// generated and an upsert sent. Otherwise the document matching the _id of the document will be updated. + /// + /// The document. + /// if set to true [safemode]. + /// + /// See the safemode description in the class description + /// [Obsolete("Use Save instead")] void Update(object document, bool safemode); /// - /// Inserts or updates a document in the database. If the document does not contain an _id one will be - /// generated and an upsert sent. Otherwise the document matching the _id of the document will be updated. + /// Inserts or updates a document in the database. If the document does not contain an _id one will be + /// generated and an upsert sent. Otherwise the document matching the _id of the document will be updated. /// /// The document. [Obsolete("Use Save instead")] void Update(object document); /// - /// Updates the specified document with the current document. In order to only do a partial update use a - /// document containing modifier operations ($set, $unset, $inc, etc.) + /// Updates the specified document with the current document. In order to only do a partial update use a + /// document containing modifier operations ($set, $unset, $inc, etc.) /// - /// The document. - /// The selector. - /// if set to true [safemode]. - /// See the safemode description in the class description + /// The document. + /// The selector. + /// if set to true [safemode]. + /// + /// See the safemode description in the class description + /// void Update(object document, object selector, bool safemode); /// - /// Updates the specified document with the current document. In order to only do a partial update use a - /// document containing modifier operations ($set, $unset, $inc, etc.) + /// Updates the specified document with the current document. In order to only do a partial update use a + /// document containing modifier operations ($set, $unset, $inc, etc.) /// /// The document. /// The selector. void Update(object document, object selector); /// - /// Updates the specified document with the current document. In order to only do a partial update use a - /// document containing modifier operations ($set, $unset, $inc, etc.) + /// Updates the specified document with the current document. In order to only do a partial update use a + /// document containing modifier operations ($set, $unset, $inc, etc.) /// - /// The document. - /// The selector. - /// The flags. - /// if set to true [safemode]. - /// See the safemode description in the class description + /// The document. + /// The selector. + /// The flags. + /// if set to true [safemode]. + /// + /// See the safemode description in the class description + /// void Update(object document, object selector, UpdateFlags flags, bool safemode); /// - /// Updates the specified document with the current document. In order to only do a partial update use a - /// document containing modifier operations ($set, $unset, $inc, etc.) + /// Updates the specified document with the current document. In order to only do a partial update use a + /// document containing modifier operations ($set, $unset, $inc, etc.) /// /// The to update with - /// The query spec to find the document to update. + /// The query selector to find the document to update. /// void Update(object document, object selector, UpdateFlags flags); @@ -265,30 +307,32 @@ public interface IMongoCollection where T : class void UpdateAll(object document, object selector); /// - /// Runs a multiple update query against the database. It will wrap any - /// doc with $set if the passed in doc doesn't contain any '$' modifier ops. + /// Runs a multiple update query against the database. It will wrap any + /// doc with $set if the passed in doc doesn't contain any '$' modifier ops. /// - /// The document. - /// The selector. - /// if set to true [safemode]. - /// See the safemode description in the class description + /// The document. + /// The selector. + /// if set to true [safemode]. + /// + /// See the safemode description in the class description + /// void UpdateAll(object document, object selector, bool safemode); /// - /// Inserts or updates a document in the database. If the document does not contain an _id one will be - /// generated and an upsert sent. Otherwise the document matching the _id of the document will be updated. + /// Inserts or updates a document in the database. If the document does not contain an _id one will be + /// generated and an upsert sent. Otherwise the document matching the _id of the document will be updated. /// - /// The document. + /// The document. /// - /// The document will contain the _id that is saved to the database. + /// The document will contain the _id that is saved to the database. /// void Save(object document); /// - /// Saves a document to the database using an upsert. + /// Saves a document to the database using an upsert. /// - /// The document. - /// if set to true [safemode]. - void Save(object document,bool safemode); + /// The document. + /// if set to true [safemode]. + void Save(object document, bool safemode); } } \ No newline at end of file diff --git a/source/MongoDB/Linq/LinqExtensions.cs b/source/MongoDB/Linq/LinqExtensions.cs index c0387970..9decc091 100644 --- a/source/MongoDB/Linq/LinqExtensions.cs +++ b/source/MongoDB/Linq/LinqExtensions.cs @@ -27,9 +27,21 @@ public static class LinqExtensions /// /// The collection. /// The selector. + [Obsolete("Use Remove instead")] public static void Delete(this IMongoCollection collection, Expression> selector) where T : class { - collection.Delete(GetQuery(collection, selector)); + collection.Remove(GetQuery(collection, selector)); + } + + /// + /// Removes the specified collection. + /// + /// + /// The collection. + /// The selector. + public static void Remove(this IMongoCollection collection, Expression> selector) where T : class + { + collection.Remove(GetQuery(collection, selector)); } /// diff --git a/source/MongoDB/MongoCollection_1.cs b/source/MongoDB/MongoCollection_1.cs index 4a390ebf..f31e53c3 100644 --- a/source/MongoDB/MongoCollection_1.cs +++ b/source/MongoDB/MongoCollection_1.cs @@ -6,7 +6,6 @@ using MongoDB.Connections; using MongoDB.Protocol; using MongoDB.Results; -using MongoDB.Serialization; using MongoDB.Util; namespace MongoDB @@ -340,11 +339,27 @@ public MongoCollection(MongoConfiguration configuration, Connection connection, /// /// An empty document will match all documents in the collection and effectively truncate it. /// - public void Delete(object selector, bool safemode){ + [Obsolete("Use Remove instead")] + public void Delete(object selector, bool safemode) + { Delete(selector); CheckError(safemode); } + /// + /// Remove documents from the collection according to the selector. + /// + /// The selector. + /// if set to true [safemode]. + /// + /// An empty document will match all documents in the collection and effectively truncate it. + /// See the safemode description in the class description + /// + public void Remove(object selector, bool safemode){ + Remove(selector); + CheckError(safemode); + } + /// /// Deletes documents from the collection according to the spec. /// @@ -352,6 +367,7 @@ public MongoCollection(MongoConfiguration configuration, Connection connection, /// /// An empty document will match all documents in the collection and effectively truncate it. /// + [Obsolete("Use Remove instead")] public void Delete(object selector){ var writerSettings = _configuration.SerializationFactory.GetBsonWriterSettings(typeof(T)); @@ -366,6 +382,30 @@ public MongoCollection(MongoConfiguration configuration, Connection connection, } } + /// + /// Remove documents from the collection according to the selector. + /// + /// The selector. + /// + /// An empty document will match all documents in the collection and effectively truncate it. + /// + public void Remove(object selector){ + var writerSettings = _configuration.SerializationFactory.GetBsonWriterSettings(typeof(T)); + + try + { + _connection.SendMessage(new DeleteMessage(writerSettings) + { + FullCollectionName = FullName, + Selector = selector + }); + } + catch(IOException exception) + { + throw new MongoConnectionException("Could not delete document, communication failure", _connection, exception); + } + } + /// /// Updates the specified document. /// diff --git a/source/MongoDB/Obsolete/IMongoCollection.cs b/source/MongoDB/Obsolete/IMongoCollection.cs index 939fce8f..01f6fa34 100644 --- a/source/MongoDB/Obsolete/IMongoCollection.cs +++ b/source/MongoDB/Obsolete/IMongoCollection.cs @@ -38,11 +38,11 @@ public interface IMongoCollection CollectionMetadata MetaData { get; } /// - /// Finds the one. + /// Finds the one. /// - /// The spec. + /// The selector. /// - Document FindOne(Document spec); + Document FindOne(Document selector); /// /// Finds all. @@ -58,11 +58,11 @@ public interface IMongoCollection ICursor Find(String @where); /// - /// Finds the specified spec. + /// Finds the specified selector. /// - /// The spec. + /// The selector. /// - ICursor Find(Document spec); + ICursor Find(Document selector); /// /// Finds the specified spec. @@ -88,42 +88,42 @@ public interface IMongoCollection /// by default. /// /// The document. - /// to find the document. + /// The selector. /// A - Document FindAndModify(Document document, Document spec); + Document FindAndModify(Document document, Document selector); /// /// Executes a query and atomically applies a modifier operation to the first document returning the original document /// by default. /// /// The document. - /// to find the document. + /// The selector. /// containing the names of columns to sort on with the values being the /// A /// - Document FindAndModify(Document document, Document spec, Document sort); + Document FindAndModify(Document document, Document selector, Document sort); /// /// Executes a query and atomically applies a modifier operation to the first document returning the original document /// by default. /// /// The document. - /// to find the document. + /// The selector. /// if set to true [return new]. /// A - Document FindAndModify(Document document, Document spec, bool returnNew); + Document FindAndModify(Document document, Document selector, bool returnNew); /// /// Executes a query and atomically applies a modifier operation to the first document returning the original document /// by default. /// /// The document. - /// to find the document. + /// The selector. /// containing the names of columns to sort on with the values being the /// /// if set to true [return new]. /// A - Document FindAndModify(Document document, Document spec, Document sort, bool returnNew); + Document FindAndModify(Document document, Document selector, Document sort, bool returnNew); /// /// Maps the reduce. @@ -144,11 +144,11 @@ public interface IMongoCollection long Count(); /// - /// Counts the specified spec. + /// Counts the specified spec. /// - /// The spec. + /// The selector. /// - long Count(Document spec); + long Count(Document selector); /// /// Inserts the specified doc. @@ -180,15 +180,30 @@ public interface IMongoCollection /// Deletes the specified selector. /// /// The selector. + [Obsolete("Use Remove instead")] void Delete(Document selector); + /// + /// Removes the specified selector. + /// + /// The selector. + void Remove(Document selector); + /// /// Deletes the specified selector. /// /// The selector. /// if set to true [safemode]. + [Obsolete("Use Remove instead")] void Delete(Document selector, bool safemode); + /// + /// Removes the specified selector. + /// + /// The selector. + /// if set to true [safemode]. + void Remove(Document selector, bool safemode); + /// /// Updates the specified doc. /// diff --git a/source/MongoDB/Obsolete/MongoCollection.cs b/source/MongoDB/Obsolete/MongoCollection.cs index d3b9ad25..e95cb2b9 100644 --- a/source/MongoDB/Obsolete/MongoCollection.cs +++ b/source/MongoDB/Obsolete/MongoCollection.cs @@ -1,7 +1,7 @@ +using System; using System.Collections.Generic; using MongoDB.Configuration; using MongoDB.Connections; -using MongoDB.Serialization; namespace MongoDB { @@ -247,19 +247,38 @@ public Document FindAndModify (Document document, Document spec, Document sort, /// Deletes the specified selector. /// /// The selector. + [Obsolete("Use Remove instead")] public void Delete(Document selector){ _collection.Delete(selector); } + /// + /// Removes the specified selector. + /// + /// The selector. + public void Remove(Document selector){ + _collection.Remove(selector); + } + /// /// Deletes the specified selector. /// /// The selector. /// if set to true [safemode]. + [Obsolete("Use Remove instead")] public void Delete(Document selector, bool safemode){ _collection.Delete(selector, safemode); } + /// + /// Removes the specified selector. + /// + /// The selector. + /// if set to true [safemode]. + public void Remove(Document selector, bool safemode){ + _collection.Remove(selector, safemode); + } + /// /// Updates the specified doc. ///