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

Failed update with $mul errors with reference to $inc

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 2.5.4
    • Fix Version/s: None
    • Component/s: Write Ops
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Trivial to reproduce, just set a field to a string, then try to multiply it and you get the $inc error:

      db.foo.update({}, {$mul : {a : 2}}, false, {multi : true}, {ordered : false})
      Update WriteResult({
      	"ok" : 1,
      	"nDocsModified" : 0,
      	"n" : 0,
      	"writeErrors" : [
      		{
      			"index" : 0,
      			"code" : 16837,
      			"errmsg" : "Cannot apply $inc to a value of non-numeric type. {_id: ObjectId('52d44e8d4166d7524db9bd2d')} has the field 'a' of non-numeric type String"
      		}
      	]
      })

      Proposed fix (needs validation):

      https://github.com/mongodb/mongo/pull/610

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              scotthernandez Scott Hernandez
              Reporter:
              adam@comerford.net Adam Comerford
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: