Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue with Modifiers in FindAndUpdate #39

Closed
wants to merge 37 commits into from

4 participants

@RexMorgan

When attempting to do a FindAndModify, the EnsureUpdateDocument method checks to ensure that if there are no modifiers, it wraps the update with a $set.

This fix is also mentioned here, although I imagine this could possibly break other areas:
http://groups.google.com/group/mongodb-csharp/browse_thread/thread/4741c1106fc027c4/5ee287dac5207df1?#5ee287dac5207df1

It was checking the properties on my domain entity instead of the update document that I'm passing in. After I made this change, the following piece of code began to work:
var collection = db.GetCollection();

            collection.Remove(new Document());
            collection.Insert(new Sequence { Name = "test", Value = 1 });

            var spec = new Document().Add("Name", "test");
            var update = Mo.Inc("Value", 1);

            var document = collection.FindAndModify(update, spec, true);
            Console.WriteLine("Value: " + document.Value);

Before it was creating a key called $inc in my document and setting it's value to a document with a key/value of Value/1.

lanwin and others added some commits
@lanwin lanwin Update README.rst 62bd5e8
@lanwin lanwin Fix code formatting 9f1d086
@lanwin lanwin Fix tests. 93c2f2e
@lanwin lanwin Return null if null array is passed to ValueConverter. 1e98fb5
@lanwin lanwin FIX MAYOR BUG: Limit returns wrong result for large resultsets. 9b7d930
@lanwin lanwin Add CollectionMemberMapTests to check if they correctly handle get an…
…d set null value.
52bda60
@lanwin lanwin Merge branch 'master' of github.com:mongodb-csharp/mongodb-csharp 20fcd78
@lanwin lanwin Fix SlaveOk name 2ea1bc0
@lanwin lanwin Expose QueryObject to VS Debugger so that its now possible to debug l…
…inq queries outside of the MongoDB-CSharp project.
e1305e6
@lanwin lanwin Add ResponseFlags. 725088f
@lanwin lanwin Throw if cursor returns a query failure. Currently without message. 89a797c
@lanwin lanwin Throw a proper message if cursor is of type Document. 2336ca3
@lanwin lanwin Add MongoTimestamp type. 3eb7873
@lanwin lanwin Extend BsonReader and BsonWriter to read and write MongoTimestamp. f57a416
@lanwin lanwin Add param to not throw if a command fails. a1608d8
@lanwin lanwin Use SendCommand which dose not throws an exception on find and modify. 3a3d3c4
@testn testn add generic mapper 1157e20
@testn testn implement IDictionaryEnumerator to make sure that it can be serialize…
…d/deserialized properly
38418fb
@testn testn improve BsonReader performance 7ed74d5
@testn testn Merge branch 'master' of http://github.com/mongodb-csharp/mongodb-csharp
dc76189
@testn testn implement IDictionaryEnumerator to make sure that it can be serialize…
…d/deserialized properly
84ab5fa
@testn testn improve BsonReader performance 5b1a962
@testn testn use linq expression for object creation 0f19da5
@testn testn improve array serialization f30099f
@testn testn Merge branch 'master' of http://github.com/mongodb-csharp/mongodb-csharp
608dd2c
@testn testn Revert "add generic mapper"
This reverts commit 1157e20dfec887cf60a2c6819d568d419c227e20.
87611d8
@testn testn add SequenceEqual implementation d4f4d20
@lanwin lanwin Use MongoConfiguration.Default instead of creating new ones on Mongo …
…ctor.
969069f
@craiggwilson craiggwilson added fix for nested array contains. 485801d
@craiggwilson craiggwilson fixed ! operator to transform call into == false. Also, removed incor…
…rect implementation of operator.
19d0406
@craiggwilson craiggwilson fixed bug in chained method calls when the target property was named …
…differently than the original property.
2802698
@craiggwilson craiggwilson fixed issue 19 in a roundabout way. de04140
@lanwin lanwin Drastically improve performance when ConnectionLifetime was less then…
… a hour due to a bug in ConnectionPool where all connection are exceed its livetime after one use.

Add minor performance improvement with dose not calc Lifetime on each check, instead cal it once since it dose not change after that.
dcb7912
@lanwin lanwin Fix explain 2ffb790
@lanwin lanwin Return default value if it is a value type and null is passed. 9d33fd3
@lanwin lanwin Dont clone other bytes on when comparing two Oids. This should speedu…
…p compare operations.
f6e51ad
@RexMorgan RexMorgan Fixed the modifiers from being wrapped by a . 6cdcdee
@RexMorgan

I didn't realize this wasn't the most up to date fork.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 26, 2010
  1. @lanwin

    Update README.rst

    lanwin authored
  2. @lanwin

    Fix code formatting

    lanwin authored
Commits on Sep 28, 2010
  1. @lanwin

    Fix tests.

    lanwin authored
  2. @lanwin
  3. @lanwin
  4. @lanwin
  5. @lanwin
Commits on Sep 29, 2010
  1. @lanwin

    Fix SlaveOk name

    lanwin authored
Commits on Sep 30, 2010
  1. @lanwin

    Expose QueryObject to VS Debugger so that its now possible to debug l…

    lanwin authored
    …inq queries outside of the MongoDB-CSharp project.
Commits on Oct 7, 2010
  1. @lanwin

    Add ResponseFlags.

    lanwin authored
  2. @lanwin
  3. @lanwin
Commits on Oct 8, 2010
  1. @lanwin

    Add MongoTimestamp type.

    lanwin authored
  2. @lanwin
Commits on Oct 20, 2010
  1. @lanwin
  2. @lanwin
Commits on Oct 21, 2010
  1. @testn

    add generic mapper

    testn authored
  2. @testn
  3. @testn

    improve BsonReader performance

    testn authored
  4. @testn
Commits on Oct 25, 2010
  1. @testn @lanwin

    implement IDictionaryEnumerator to make sure that it can be serialize…

    testn authored lanwin committed
    …d/deserialized properly
  2. @testn @lanwin

    improve BsonReader performance

    testn authored lanwin committed
Commits on Oct 26, 2010
  1. @testn
  2. @testn

    improve array serialization

    testn authored
  3. @testn
  4. @testn

    Revert "add generic mapper"

    testn authored
    This reverts commit 1157e20dfec887cf60a2c6819d568d419c227e20.
  5. @testn

    add SequenceEqual implementation

    testn authored
Commits on Nov 1, 2010
  1. @lanwin
Commits on Nov 8, 2010
  1. @craiggwilson @lanwin

    added fix for nested array contains.

    craiggwilson authored lanwin committed
  2. @craiggwilson @lanwin

    fixed ! operator to transform call into == false. Also, removed incor…

    craiggwilson authored lanwin committed
    …rect implementation of operator.
  3. @craiggwilson @lanwin

    fixed bug in chained method calls when the target property was named …

    craiggwilson authored lanwin committed
    …differently than the original property.
  4. @craiggwilson @lanwin

    fixed issue 19 in a roundabout way.

    craiggwilson authored lanwin committed
Commits on Nov 11, 2010
  1. @lanwin

    Drastically improve performance when ConnectionLifetime was less then…

    lanwin authored
    … a hour due to a bug in ConnectionPool where all connection are exceed its livetime after one use.
    
    Add minor performance improvement with dose not calc Lifetime on each check, instead cal it once since it dose not change after that.
Commits on Dec 14, 2010
  1. @lanwin

    Fix explain

    lanwin authored
Commits on Feb 4, 2011
  1. @lanwin
Commits on Feb 16, 2011
  1. @lanwin
Commits on Mar 8, 2011
  1. @RexMorgan
Something went wrong with that request. Please try again.