microsoft / microsoft/vscode-documentdb

Bulk Editing of Data 🚀

Open
#60 0 comments 0 reactions 1 assignee View on GitHub

@xingfan-git is already working on this.

Since Jun 18, 2025.

feedback wanted
Dominant language
TypeScript
Stars
31
Forks
22
Avg merge
2d 20h
Merged PRs (30d)
21

Description

Bulk Editing of Data: Feedback and Collaboration Welcome! 🚀

We propose Bulk Editing Support for DocumentDB and MongoDB databases, a feature designed to help developers make large-scale changes to their data efficiently and safely. This feature will allow users to rename, add, or remove fields across multiple documents, with robust controls for targeting specific datasets and managing errors. Here's the concept and how your feedback can help refine it.


Proposed Feature Overview

Bulk editing is a practical capability that simplifies large-scale changes to data in DocumentDB and MongoDB databases. This feature will provide a flexible and interactive interface for defining bulk operations and managing them with confidence, complete with progress reporting and error handling.

Core Features
  1. Rename Fields Across Documents

    • Change the name of a field in all or selected documents within a collection.
    • Support for maintaining nested field structures during renaming (e.g., address.streetlocation.street).
  2. Remove Fields from Documents

    • Delete unwanted fields from documents, whether top-level or nested.
    • Provide an option to target only documents where the field exists.
  3. Add Fields to Documents

    • Insert new fields into documents with:
      • Static default values.
  4. Targeted Bulk Operations

    • Allow users to specify the scope of the operation:
      • All Documents in the Collection: Apply the changes globally.
      • Documents Matching Current Query: Use the query editor to define a subset of documents.
      • Selected Documents: Operate on manually selected documents.
  5. Error Handling Options

    • Enable users to define how errors are managed during the operation:
      • Continue on Errors: Log errors and proceed with the rest of the operation.
      • Abort on Errors: Stop the operation and provide an error summary.
    • Transactional Rollbacks: Discuss whether failed operations should attempt rollback (see discussion below for transaction implications).
  6. Progress Reporting

    • Display real-time progress for long-running operations, including:
      • Total documents processed.
      • Number of successful changes.
      • Number of errors encountered.
  7. Interactive Bulk Editing UI

    • A user-friendly interface for defining bulk operations with clear guidance and feedback.
    • Preview the scope and impact of changes before execution.

We Need Your Feedback!

Discussion Areas
  1. Dynamic Values for Added Fields

    • How important is it to support dynamic values (e.g., values derived from other fields or expressions like $concat or $sum)?
    • While basic operations like counting characters or calculating simple sums are feasible, handling complex transformations is a significant challenge.
    • Should this functionality be deferred to aggregation pipelines, which are better suited for complex operations?
  2. Error Handling and Transactions

    • Should operations support transactional rollbacks for consistency in case of failures?
    • DocumentDB and MongoDB databases support transactions for multi-document operations, but they are limited to certain configurations.
    • For very large operations, transactions may require significant resources and could impact performance. Would users prefer partial updates with detailed logs, or strict rollbacks requiring retries in smaller batches?
  3. Scalability and Performance

    • For bulk edits on large collections, are there specific performance optimizations or controls users would like?
    • Should the feature include batch-based processing to handle larger datasets without overwhelming the database?

How It Will Work

  1. Define Bulk Operation

    • Select the operation type: rename, add, or remove a field.
    • Use the interactive UI to configure the operation:
      • For renames: Specify old and new field names.
      • For additions: Define the new field and assign a static default value.
      • For removals: Specify the field to delete, with an option to restrict to documents where it exists.
  2. Target Documents

    • Choose the scope of the operation:
      • Entire collection.
      • Documents matching a query.
      • Selected documents from a preview.
  3. Configure Error Handling

    • Define how errors will be managed:
      • Continue on Errors: Log errors and proceed.
      • Abort on Errors: Stop the operation and display an error summary.
      • Transactional Rollbacks: Explore the feasibility of using transactions to undo changes if errors occur (see limitations in the discussion above).
  4. Execute Operation and Monitor Progress

    • Initiate the operation with real-time feedback:
      • Show progress bar and statistics (e.g., processed, successful, failed documents).
      • Highlight errors with detailed logs for troubleshooting.
  5. Complete and Review

    • Provide a summary of the operation:
      • Total documents processed.
      • Changes applied.
      • Errors encountered, with links to logs or suggestions for resolution.

Draft Development Plan

  1. Operation Logic and Query Integration

    • Develop backend logic for rename, add, and remove operations.
    • Integrate with aggregation pipelines for efficiency where appropriate.
  2. Interactive UI for Bulk Editing

    • Build a React-based interface for defining and executing bulk operations.
    • Include visual previews of affected documents.
  3. Error Management and Reporting

    • Implement robust error handling with options for logging, halting, or rolling back changes.
    • Evaluate transaction feasibility for rollback support.
  4. Progress Reporting and Feedback

    • Design real-time progress indicators and statistics.
    • Ensure responsiveness for long-running operations.
  5. Testing and Validation

    • Test with large datasets to ensure performance and reliability.
    • Validate compatibility with nested and dynamic field structures.
  6. Documentation and User Guide

    • Provide clear instructions for configuring and executing bulk operations.
    • Include best practices for error handling, transactional considerations, and performance optimization.

What’s Next?

This is the initial concept for Bulk Editing Support. With your feedback, we’ll refine and enhance this feature to make it as practical and user-friendly as possible. Together, let’s build an effective experience for managing data at scale in DocumentDB and MongoDB databases! 🌟

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.