Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 27, 2025

Implements collection-level copy-and-paste for small-scale data migrations between DocumentDB/MongoDB databases. Data flows through the user's local machine using a streaming architecture with configurable conflict resolution.

Core Components

  • Task Service (src/services/taskService/): State machine for long-running operations with progress tracking, cancellation, and VS Code UI integration
  • Document Streaming API (src/services/taskService/data-api/):
    • BaseDocumentReader / DocumentDbDocumentReader: Async streaming with keep-alive for large collections
    • StreamingDocumentWriter / DocumentDbStreamingWriter: Batched writes with transaction support
  • Conflict Resolution: Abort, skip, or overwrite strategies for duplicate _id handling

Commands

  • documentDB.copyCollection - Copies collection reference to clipboard
  • documentDB.pasteCollection - Pastes documents to target collection with conflict strategy selection

Key Implementation Details

// Streaming read with keep-alive for large collections
for await (const doc of reader.streamDocuments({ keepAlive: true })) {
    yield doc;
}

// Batched writes with configurable conflict handling
await writer.streamDocuments(documentStream, {
    conflictStrategy: 'skip',  // 'abort' | 'skip' | 'overwrite'
    batchSize: 100,
});

Configuration

  • documentDB.copyPaste.showLargeCollectionWarning - Warn before copying large collections
  • documentDB.copyPaste.largeCollectionWarningThreshold - Document count threshold (default: 10,000)

closes #63


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link
Contributor Author

Copilot AI commented Nov 27, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/vscode-documentdb/vscode-documentdb/node_modules/.bin/vscode-test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add easy data migrations feature for DocumentDB and MongoDB Feature: Easy Data Migrations (Collection Copy-and-Paste) Nov 27, 2025
Copilot AI requested a review from tnaum-ms November 27, 2025 13:28
@tnaum-ms tnaum-ms marked this pull request as ready for review November 27, 2025 15:45
@tnaum-ms tnaum-ms requested a review from a team as a code owner November 27, 2025 15:45
@tnaum-ms tnaum-ms merged commit d1706ce into feature/copy-and-paste Nov 27, 2025
5 checks passed
@tnaum-ms tnaum-ms deleted the copilot/sub-pr-170 branch November 27, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants