Returning WriteResult from eval fails

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.6.0
    • Component/s: JavaScript, Shell
    • Server Security
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When you run something like this it fails to deserialize the WriteResult on the client (shell):

      > db.eval(function(){return db.nothing.update({fake:1},{$set:{a:1}})})
      2014-04-21T08:56:42.415-0400 ReferenceError: writeConcern is not defined
      > var res = db.eval(function(){return db.nothing.update({fake:1},{$set:{a:1}})})
      >s res.nInserted
      0
      > res.tojson()
      2014-04-21T08:58:49.077-0400 ReferenceError: singleBatchType is not defined
      
      // converting to json from WriteResult works much better.
      > db.eval(function(){return db.nothing.update({fake:1},{$set:{a:1}}).tojson()})
      { "nMatched" : 0, "nUpserted" : 0, "nModified" : 0 }
      

      This is probably due to the fact that most of the types are defined in an enclosure and not public, but more investigation should be done.

              Assignee:
              [DO NOT USE] Backlog - Security Team
              Reporter:
              Scott Hernandez (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: