Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6996

findAndModify triggering assertion but still modifying record

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL

      I successfully replicated the following error reported on GG:

      https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/0V8Irg2rZgI

      ------------------------------

      i test the code in mongo shell,and php driver, get the same result

      it seems like some bug happened on server

      =====
      > uo
      { "_id" : 80, "bag" :

      { "bm1" : 10, "bm2" : 1 }

      , "money" : 450 }
      > db.s1_users.save(uo)
      > cmd
      {
      "findAndModify" : "s1_users",
      "query" : {
      "money" :

      { "$gte" : 50 }

      ,
      "bag.bm1" :

      { "$gte" : 10 }

      ,
      "_id" : 80
      },
      "update" : {
      "$inc" :

      { "money" : -50, "bag.bm1" : -10 }

      },
      "fields" :

      { "money" : 1, "bag.bm1" : 1 }

      ,
      "new" : true,
      "upsert" : true
      }
      > db.runCommand(cmd)
      {
      "errmsg" : "exception: assertion src/mongo/db/commands/find_and_modify.cpp:184",
      "code" : 0,
      "ok" : 0
      }

      //the data was modified

      db.s1_users.findOne({_id:80,'money':{'$gte':50}});
      { "_id" : 80, "bag" :

      { "bm1" : 0, "bm2" : 1 }

      , "money" : 400 }

      if i remove the query condition
      "bag.bm1" :

      { "$gte" : 10 }

      it worked .

            Assignee:
            Unassigned Unassigned
            Reporter:
            stephen.lee Stephen Lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: