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

Object.extend doesn't handle null properties

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.2.13, 3.3.11
    • JavaScript
    • None
    • Fully Compatible
    • ALL
    • v3.2, v3.0
    • Platforms 18 (08/05/16)
    • 0

    Description

      Ran into this issue adapting mongo-perf to run some internal bench marks. A query op such as this:

      ops : [
        { op: "find",
          ns: "app-test.emails",
          query: {
            accountId: "12345-67890-12345-67890",
            _type: { $ne: null }
          }
        }
      ]
      

      produces the following error:

      Error running test [object Object]: Cannot use 'in' operator to search for 'floatApprox' in null:TypeError: Cannot use 'in' operator to search for 'floatApprox' in null
      at Function.Object.extend (src/mongo/shell/types.js:228:34)
      at Function.Object.extend (src/mongo/shell/types.js:231:28)
      at Function.Object.extend (src/mongo/shell/types.js:231:28)
      at util/utils.js:86:29
      at Array.forEach (native)
      at runTest (util/utils.js:82:14)
      at runTests (util/utils.js:369:38)
      at mongoPerfRunTests (util/utils.js:421:19)
      at (shell):1:1
      

      The issue is that in javascript:

      [00:09:51] tim@Timo:~/src/mongo $ node
      > typeof(null)
      'object'
      

      and the code being modified in the PR is trying to deep copy an object, verifying the property is an object by using typeof().

      Attachments

        Issue Links

          Activity

            People

              jason.carey@mongodb.com Jason Carey
              tim@lever.co Tim Sogard
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: