Investigate removing copyJson() in favor of existing copy utils

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      From max.hirschhorn@mongodb.com:

      Now that I look at the implementation of copyJSON, I realize a couple things

      1. The input argument isn't JSON (which would be a string representation) and is instead a JavaScript object.
      2. The idiom in the mongo shell for deep copying a JavaScript object is typically expressed as Object.extend({}, theObjectToCopy, /deep=/ true) because Object.extend() is designed to also copy our custom JavaScript types. These custom types may not be relevant for process arguments because process arguments tend to be primitive types and arrays/objects of primitive types. However, adding a shorter syntax of Object.deepCopy(theObjectToCopy) to src/mongo/shell/types.js seems like it'd be an ok alternative.
        https://github.com/10gen/mongo/blob/d7ac758142246187351f1258e98f95a719c7230e/src/mongo/shell/types.js#L268
        There's also TxnUtil.deepCopyObject({}, theObjectToCopy) which handle a few more JavaScript types than Object.extend() as another basis for the shorter syntax version.
        https://github.com/10gen/mongo/blob/d7ac758142246187351f1258e98f95a719c7230e/jstests/libs/txns/txn_util.js#L100-L104

      We should investigate if we can remove our copyJson, or at least make an improvement so the util is (named?) more accurate.

            Assignee:
            Unassigned
            Reporter:
            Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: