diff --git a/source/MongoDB.Tests/IntegrationTests/TestCollection.cs b/source/MongoDB.Tests/IntegrationTests/TestCollection.cs
index 83fe7047..3aa6da98 100644
--- a/source/MongoDB.Tests/IntegrationTests/TestCollection.cs
+++ b/source/MongoDB.Tests/IntegrationTests/TestCollection.cs
@@ -192,57 +192,57 @@ public void TestFindWhereEquivalency()
Assert.AreEqual(4, CountDocs(col.Find(explicitWhere)), "Explicit where didn't return 4 docs");
Assert.AreEqual(4, CountDocs(col.Find(funcDoc)), "Function where didn't return 4 docs");
}
-
- [Test]
- public void TestFindAndModifyReturnsOldDocument() {
- IMongoCollection collection = DB["find_and_modify"];
- Document person = new Document().Append("First", "Sally").Append("Last", "Simmons");
- collection.Insert(person);
-
- Document spec = new Document().Append("_id", person["_id"]);
- Document loaded = collection.FindAndModify(new Document().Append("First", "Jane"), spec);
-
- Assert.AreEqual("Sally", loaded["First"]);
- }
-
- [Test]
- public void TestFindAndModifyReturnsNewDocument() {
- IMongoCollection collection = DB["find_and_modify"];
- Document person = new Document().Append("First", "Susie").Append("Last", "O'Hara");
- collection.Insert(person);
-
- Document spec = new Document().Append("_id", person["_id"]);
- Document loaded = collection.FindAndModify(new Document().Append("First", "Darlene"), spec, true);
-
- Assert.AreEqual("Darlene", loaded["First"]);
- }
-
- [Test]
- public void TestFindAndModifySortsResults() {
- IMongoCollection collection = DB["find_and_modify"];
- Document doc1 = new Document().Append("handled", false).Append("priority", 1).Append("value", "Test 1");
- Document doc2 = new Document().Append("handled", false).Append("priority", 2).Append("value", "Test 2");
- collection.Insert(doc1);
- collection.Insert(doc2);
-
- Document update = new Document().Append("handled", true);
- Document spec = new Document().Append("handled", false);
- Document sort = new Document().Append("priority", -1);
- Document loaded = collection.FindAndModify(update, spec, sort, true);
-
- Assert.AreEqual(true, loaded["handled"]);
- Assert.AreEqual(doc2["priority"], loaded["priority"]);
- Assert.AreEqual(doc2["value"], loaded["value"]);
- }
-
- [Test]
- public void TestFindAndModifyReturnNullForNoRecordFound() {
- IMongoCollection collection = DB["find_and_modify"];
- Document spec = new Document().Append("FirstName", "Noone");
- Document loaded = collection.FindAndModify(new Document().Append("First", "Darlene"), spec, true);
-
- Assert.IsNull(loaded, "Should return null for no document found");
- }
+
+ [Test]
+ public void TestFindAndModifyReturnsOldDocument() {
+ IMongoCollection collection = DB["find_and_modify"];
+ Document person = new Document().Append("First", "Sally").Append("Last", "Simmons");
+ collection.Insert(person);
+
+ Document spec = new Document().Append("_id", person["_id"]);
+ Document loaded = collection.FindAndModify(new Document().Append("First", "Jane"), spec);
+
+ Assert.AreEqual("Sally", loaded["First"]);
+ }
+
+ [Test]
+ public void TestFindAndModifyReturnsNewDocument() {
+ IMongoCollection collection = DB["find_and_modify"];
+ Document person = new Document().Append("First", "Susie").Append("Last", "O'Hara");
+ collection.Insert(person);
+
+ Document spec = new Document().Append("_id", person["_id"]);
+ Document loaded = collection.FindAndModify(new Document().Append("First", "Darlene"), spec, true);
+
+ Assert.AreEqual("Darlene", loaded["First"]);
+ }
+
+ [Test]
+ public void TestFindAndModifySortsResults() {
+ IMongoCollection collection = DB["find_and_modify"];
+ Document doc1 = new Document().Append("handled", false).Append("priority", 1).Append("value", "Test 1");
+ Document doc2 = new Document().Append("handled", false).Append("priority", 2).Append("value", "Test 2");
+ collection.Insert(doc1);
+ collection.Insert(doc2);
+
+ Document update = new Document().Append("handled", true);
+ Document spec = new Document().Append("handled", false);
+ Document sort = new Document().Append("priority", -1);
+ Document loaded = collection.FindAndModify(update, spec, sort, true);
+
+ Assert.AreEqual(true, loaded["handled"]);
+ Assert.AreEqual(doc2["priority"], loaded["priority"]);
+ Assert.AreEqual(doc2["value"], loaded["value"]);
+ }
+
+ [Test]
+ public void TestFindAndModifyReturnNullForNoRecordFound() {
+ IMongoCollection collection = DB["find_and_modify"];
+ Document spec = new Document().Append("FirstName", "Noone");
+ Document loaded = collection.FindAndModify(new Document().Append("First", "Darlene"), spec, true);
+
+ Assert.IsNull(loaded, "Should return null for no document found");
+ }
[Test]
public void TestInsertBulkLargerThan4MBOfDocuments()
diff --git a/source/MongoDB/MongoCollection_1.cs b/source/MongoDB/MongoCollection_1.cs
index 49445585..85c924b4 100644
--- a/source/MongoDB/MongoCollection_1.cs
+++ b/source/MongoDB/MongoCollection_1.cs
@@ -7,7 +7,6 @@
using MongoDB.Protocol;
using MongoDB.Results;
using MongoDB.Util;
-using MongoDB.Configuration.Mapping.Model;
namespace MongoDB
{
@@ -183,7 +182,7 @@ public T FindOne(string javascriptWhere)
/// A
///
public T FindAndModify(object document, object spec, object sort){
- return FindAndModify(document, spec, sort);
+ return FindAndModify(document, spec, sort, false);
}
///