ReferenceError: singleBatchType is not defined when attempting to retrieve a document

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Overview
      We have noticed that we are unable to retrieve a document successfully via the mongo shell or by using the java driver.

      mongo
      An attempt to retrieve the mongo document via mongoshell results in the following:

      MongoDB shell version: 3.2.10
      connecting to: mongodb.example.net/testdb
      Welcome to the MongoDB shell.
      For interactive help, type "help".
      For more comprehensive documentation, see
      	http://docs.mongodb.org/
      Questions? Try the support group
      	http://groups.google.com/group/mongodb-user
      floow:PRIMARY> db.users.find({"_id":ObjectId("57fbaa66f48ba92249b75916")})
      ReferenceError: singleBatchType is not defined
      

      mongoexport
      In an attempt to look at the document and the state of the document, we attempted to export it via mongoexport, this resulted in the following:

      mongoexport -h mongodb.example.net -d testdb -c users | grep "57fbaa66f48ba92249b75916"
      2017-01-18T07:55:54.329+0000	connected to: mongodb.example.net
      {"_id":{"$oid":"57fbaa66f48ba92249b75916"},"ok":{"$undefined":true},"nInserted":1.0,"nUpserted":0.0,"nMatched":0.0,"nModified":0.0,"nRemoved":0.0,"getUpsertedId":{"$code":"function () {\n      if (bulkResult.upserted.length == 0) {\n        return null;\n      }\n\n      return bulkResult.upserted[bulkResult.upserted.length - 1];\n    }"},"getRawResponse":{"$code":"function () {\n      return bulkResult;\n    }"},"getWriteError":{"$code":"function () {\n      if (bulkResult.writeErrors.length == 0) {\n        return null;\n      } else {\n        return bulkResult.writeErrors[bulkResult.writeErrors.length - 1];\n      }\n    }"},"hasWriteError":{"$code":"function () {\n      return this.getWriteError() != null;\n    }"},"getWriteConcernError":{"$code":"function () {\n      if (bulkResult.writeConcernErrors.length == 0) {\n        return null;\n      } else {\n        return bulkResult.writeConcernErrors[0];\n      }\n    }"},"hasWriteConcernError":{"$code":"function () {\n      return this.getWriteConcernError() != null;\n    }"},"tojson":{"$code":"function (indent, nolint) {\n      var result = {}\n\n      if(singleBatchType == INSERT) {\n        result.nInserted = this.nInserted;\n      }\n\n      if(singleBatchType == UPDATE) {\n        result.nMatched = this.nMatched;\n        result.nUpserted = this.nUpserted;\n\n        if(this.nModified != undefined)\n            result.nModified = this.nModified;\n\n        if(Array.isArray(bulkResult.upserted)\n            \u0026\u0026 bulkResult.upserted.length == 1) {\n          result._id = bulkResult.upserted[0]._id;\n        }\n      }\n\n      if(singleBatchType == REMOVE) {\n        result.nRemoved = bulkResult.nRemoved;\n      }\n\n      if(this.getWriteError() != null) {\n        result.writeError = {};\n        result.writeError.code = this.getWriteError().code;\n        result.writeError.errmsg = this.getWriteError().errmsg;\n      }\n\n      if(this.getWriteConcernError() != null) {\n        result.writeConcernError = this.getWriteConcernError();\n      }\n\n      return tojson(result, indent, nolint);\n    }"},"toString":{"$code":"function () {\n      // Suppress all output for the write concern w:0, since the client doesn't care.\n      if(writeConcern \u0026\u0026 writeConcern.w == 0) {\n        return \"WriteResult(\" + tojson({}) + \")\";;\n      }\n      return \"WriteResult(\" + this.tojson() + \")\";\n    }"},"shellPrint":{"$code":"function () {\n      return this.toString();\n    }"}}
      

            Assignee:
            Mark Agarunov (Inactive)
            Reporter:
            James Ridgway
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: