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

Object.extend doesn't handle null properties

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.13, 3.3.11
    • Component/s: JavaScript
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.2, v3.0
    • Sprint:
      Platforms 18 (08/05/16)
    • Linked BF Score:
      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

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

                Dates

                Created:
                Updated:
                Resolved: