tinycodinglm / sys /sys-0035.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 19)
034ba67 verified
|
Raw History Blame Contribute Delete
1.17 kB
opencode trace
System You are an expert software engineer.

You are an expert software engineer.

User

How does MongoDB filter documents during sharded queries?

Assistant

MongoDB uses two mechanisms to handle orphaned documents:

  1. ShardFilterStage (classic engine):

    • Drops documents not belonging to this shard
    • Holds ScopedCollectionFilter preventing deletion during active queries
    • Uses ShardFiltererImpl for shard key evaluation
  2. OrphanChunkSkipper (index/distinct scans):

    • Detects orphan keys during seeks
    • Seeks to next owned chunk boundary
    • Returns Info enum: NotOrphan/CanSkipOrphans/NoMoreOwned

Aggregation pipeline sharding:

  • InternalShredDocumentsStage: distributes documents across shards
  • InternalSplitPipelineStage: splits pipeline for scatter-gather
  • ExchangeStage: exchange-based parallelism

Write path references: oplog writes, read concern levels, transaction coordinator integration.