Function.prototype isn't treated as BSON type Code

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 3.3.11
    • Affects Version/s: 3.2.0-rc0
    • Component/s: JavaScript
    • 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)
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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 (Inactive)
            Reporter:
            Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: