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

remove legacy compatibility for bulk write insert documents

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Bulk API
    • Needed

      Use Case

      The modern bulk write API specifies inserts by specifying the document to insert in the `document` field:

      collection.bulkWrite([{ insertOne: { document: { name: 'bumpy' } } } ]);
      

      We have logic in our bulk write API that appears to support a "legacy" syntax, that omits the `document`:

      collection.bulkWrite([{ insertOne:  { name: 'bumpy' } ]);
      

      This behavior is not documented and is not supported by Typescript.

      We should remove this legacy behavior to simplify our bulk write implementation.

      User Impact

      • If users are using the legacy syntax, they'll need to wrap the inserted documents inside of an object that specifies the object to insert as the `document` field:
        • `{ name: 'bumpy' }` becomes `{ document: { name: 'bumpy' }

          }`

      Dependencies

      • n/a

      Unknowns

      • Is this change worthwhile?  The overhead of maintaining this behavior is a single line of code and it's easily testable.  This behavior is publicly exposed in mongosh, so if we remove this logic we'll shift the burden onto devtools to support the legacy behavior or they'll need to release a major version of mongosh.

      Acceptance Criteria

      Implementation Requirements

      • functional reqs, potential snafus to avoid, performance targets, etc

      Testing Requirements

      • unit test, spec test sync, etc

      Documentation Requirements

      • DOCSP ticket, API docs, etc

      Follow Up Requirements

      • additional tickets to file, required releases, etc

            Assignee:
            Unassigned Unassigned
            Reporter:
            bailey.pearson@mongodb.com Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: