Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-7735

Investigate changes in NODE-6003: remove legacy compatibility for bulk write insert documents

    • Type: Icon: Investigation Investigation
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      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:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: