Skip to content

SERVER-25192 Handle null properties in Object.extend #1103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

drags
Copy link
Contributor

@drags drags commented Jul 21, 2016

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().

@ramonfm ramonfm changed the title SERVER-25191 Handle null properties in Object.extend SERVER-25192 Handle null properties in Object.extend Jul 21, 2016
@hanumantmk
Copy link
Contributor

Thanks for your commit!

acmorrow pushed a commit that referenced this pull request Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants