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

Implement Client Bulk Write Command Builder

    • Hide

      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.

      Show
      Create a copy of the Kickoff Template with the issue key (NODE-XXX) in the filename and share a link to the new doc via this field.
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Implement the client bulk write command builder.

      AC:

      • Command builder takes in an array of write models and returns an array of bulk write commands. For this first ticket it will always be one command.
      • Implement the new model types:
      • ClientInsertOneModel<TSchema>
      • ClientUpdateOneModel<TSchema>
      • ClientUpdateManyModel<TSchema>
      • ClientReplaceOneModel<TSchema>
      • ClientDeleteOneModel<TSchema>
      • ClientDeleteManyModel<TSchema>
      • Command must be in the format:
      • {
          bulkWrite: 1,
          ops: DocumentSequence[],
          nsInfo: DocumentSequence[],
          errorsOnly: boolean,
          ordered: boolean,
          bypassDocumentValidation?: boolean,
          comment?: string,
          let?: Document
        }
      • Operations must be in the format corresponding to the model and be embedded in an document sequence object with an "ops" key.
      • {
          insert: number, // index of the namespace in nsInfo field.
          document: Document
        }
        
        {
          update: number, // index of the namespace in nsInfo field.
          filter: Document,
          updateMods: Document | Document[],
          multi?: boolean,
          upsert?: boolean,
          arrayFilters?: Document[],
          hint?: Document | string
        }
        
        {
          delete: number, // index of the namespace in nsInfo field.
          filter: Document,
          multi?: boolean,
          hint?: Document | string,
          collation?: Document
        }
        
      • nsInfo must be a document sequence with an array of unique namespace objects in the format:
      • { nsInfo: [{ ns: string }]}

       

      Testing:

      Add unit tests that pass a mixture of all available write models and assert that:

      • Insert operations are in correct format
      • Update operations are in correct format
      • Delete operations are in correct format
      • nsInfo array does not contain duplicate namespaces
      • Indexes in the operations match the correct namespace

       

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            durran.jordan@mongodb.com Durran Jordan
            Bailey Pearson, Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: