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

BinData type issues with db.eval and mapReduce

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 2.4.0-rc1
    • 2.4.0-rc2
    • JavaScript
    • None
    • ALL

    Description

      mongos> BinData()
      BinData(0,"undefined")
      mongos> eval("BinData()")
      BinData(0,"undefined")
      mongos> db.eval("BinData()")
      Wed Mar  6 15:49:33.060 JavaScript execution failed: {
      	"errmsg" : "exception: cannot convert native function to BSON",
      	"code" : 16716,
      	"ok" : 0
      } at src/mongo/shell/db.js:L567
      mongos> 

      However, this works:

      mongos> db.eval("var b = BinData(); return;")
      null

      Seems like the same issue with mapReduce, but only when emitted in the map function and called with no arguments.

      mongos> m = function () { emit("test",BinData()) }
      function () { emit("test",BinData()) }
      mongos> r = function (k, v) { return { "test" : 1 } }
      function (k, v) { return { "test" : 1 } }
      mongos> db.mrtest.mapReduce(m,r,{out:"mrtest_out"})
      Thu Mar  7 13:01:57.435 JavaScript execution failed: map reduce failed:{
      	"errmsg" : "exception: JavaScript execution failed: Error: cannot convert native function to BSON near 'tion () { emit(\"test\"' ",
      	"code" : 16722,
      	"ok" : 0
      } at src/mongo/shell/collection.js:L970
      mongos> 

      Attachments

        Activity

          People

            benjamin.becker Ben Becker
            sverch Shaun Verch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: