Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1255

All operations should be moved to `lib/operations/<class>_ops.js`

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.0
    • Affects Version/s: None
    • Component/s: Native
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Presently operations live in the code right next to wherever they are being used (e.g. Collection.prototype.createIndex and createIndex in that same file). This not only leads to a decrease in readability of these (already large) files, but also an inability to share code in these operations between methods. The problem with not being able to share these is that we currently have operations that need to use other operations (e.g. https://github.com/mongodb/node-mongodb-native/blob/3.0.0/lib/collection.js#L1387), and in these cases we now have a heavyweight chain of calls to `executeOperation` which incurs non-trivial overhead. Instead these operations should be moved to their own file(s), and allowed to be shared as "private implementation" of the driver.

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            matt.broadstone@mongodb.com Matt Broadstone
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: