Skip to content

fix(linux-drivers): count an aggregate's documents for itcount() in MongoDB - #3829

Merged
datlechin merged 1 commit into
mainfrom
fix/linux-mongodb-aggregate-itcount
Oct 24, 2026
Merged

datlechin merged 1 commit into
mainfrom
fix/linux-mongodb-aggregate-itcount

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • db.c.aggregate([...]).itcount() in the SQL editor returns the number of documents the pipeline produces, counted on the server with a $group stage, the way find(...).count() already is. feat(linux): connect to MongoDB, browse its collections and run shell statements #3820 refused it as an unsupported cursor method.
  • A pipeline that ends in $out or $merge is still refused with itcount(): the server takes no stage after one that writes.
  • explain, whether as .explain() or the {explain: true} option, still asks the planner instead.

Test plan

  • New unit test an_aggregates_itcount_counts_on_the_server: the plan ends in the $group stage and is counted; $merge is refused; {explain: true} still gives an explain.
  • a_find_reads_the_fields_it_projects_in_the_order_it_sorts (requires docker) now also runs aggregate([{$match: ...}]).itcount() against MongoDB and reads 2.
  • clippy -p tablepro-driver-mongodb --all-targets -D warnings, cargo fmt --check.

Refs #3646

@datlechin
datlechin enabled auto-merge (squash) October 24, 2026 19:36
@datlechin
datlechin merged commit 27588bf into main Oct 24, 2026
36 checks passed
@datlechin
datlechin deleted the fix/linux-mongodb-aggregate-itcount branch October 24, 2026 21:52
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.

1 participant