-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: SAMUS
-
None
-
Environment:samus-mongodb-csharp-85d3524
MongoDB 1.6
MongoCollection<T>.FindAndModify doesn't work when updating an whole document.
The following code does no change to the database:
Document query =
new Document()
{
};
mongo["DB"].GetCollection<MyClass>("Collection").FindAndModify(theModifiedInstance, query);
On the other side, the following (supposedly equivalent) works fine:
Document command =
new Document()
{
,
,
,
,
{"upsert", false}};
mongo["DB"].SendCommand(command);
The bug seems to be on line 217 of MongoCollection_1.cs (as per version given in "Environment"):
{"update", EnsureUpdateDocument(document)}EnsureUpdateDocument will create a new document with a $set. Clearly, from the example above, this should not be done.