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

Function.prototype isn't treated as BSON type Code

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.3.11
    • Affects Version/s: 3.2.0-rc0
    • Component/s: JavaScript
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide
      db.mycoll.drop();
      assert.writeOK(db.mycoll.insert({_id: 0, a: Function.prototype}));
      assert.eq(1, db.mycoll.find({a: {$type: 'javascript'}}).itcount());
      
      Show
      db.mycoll.drop(); assert.writeOK(db.mycoll.insert({_id: 0, a: Function. prototype })); assert.eq(1, db.mycoll.find({a: {$type: 'javascript' }}).itcount());
    • Platforms 13 (04/22/16), Platforms 14 (05/13/16), Platforms 15 (06/03/16), Platforms 16 (06/24/16), Platforms 17 (07/15/16), Platforms 18 (08/05/16)

      mongo shell version 3.0.11 (v8)
      > db.mycoll.find()
      { "_id" : 0, "a" : function Empty() {} }
      
      mongo shell version 3.1.9 (SpiderMonkey)
      > db.mycoll.find()
      { "_id" : 0, "a" : function () { } }
      
      mongo shell version 3.2.0-rc0 (SpiderMonkey)
      > db.mycoll.find()
      { "_id" : 0, "a" : {  } }
      > db.mycoll.find({a: {$type: 'object'}})
      { "_id" : 0, "a" : {  } }
      

            Assignee:
            waley.chen Waley Chen
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: