Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(shell-api): Align database and collection aggregate functions MONGOSH-1868 #2229

Merged
merged 5 commits into from
Oct 22, 2024

Conversation

gagik
Copy link
Contributor

@gagik gagik commented Oct 21, 2024

Looking into the documentation for both database and collection functions made me realize it'd be a lot clearer to align them completely. Instead of #2218 which would allow

db.aggregate({ $stage: 1 }, { options: true }) 
// => db.aggregate([{ $stage: 1 }], { options: true })

It'd be better to align with how db.{collection}.aggregate works i.e.

db.aggregate({ $stage: 1 }, { $stage2: true }) 
// => db.aggregate([{ $stage: 1 }, { $stage2: true })]);

This does mean if not using array, one cannot pass options but this is already the behavior of collection aggregate so it'd be best (and most intuitive) to keep it consistent.

packages/shell-api/src/collection.ts Show resolved Hide resolved
packages/shell-api/src/collection.ts Outdated Show resolved Hide resolved
@gagik gagik requested a review from addaleax October 22, 2024 07:47
@gagik gagik merged commit c65a5b5 into main Oct 22, 2024
62 of 67 checks passed
@gagik gagik deleted the gagik/match-aggregate-behavior branch October 22, 2024 14:12
nirinchev added a commit that referenced this pull request Oct 25, 2024
* main:
  chore: update auto-generated files (#2237)
  feat(shell-api): add shardedDataDistribution to sh.status() MONGOSH-1326 (#2214)
  chore: update auto-generated files (#2235)
  feat(tests): Add individual evergreen test results with XUnit (#2227)
  chore: update auto-generated files (#2234)
  chore: rename service-provider-server and `CliServiceProvider` (#2232)
  chore: update auto-generated files (#2233)
  chore(deps): Add node-gyp version control across different distros MONGOSH-1891 (#2230)
  chore: update auto-generated files (#2231)
  fix(shell-api): Align database and collection aggregate functions MONGOSH-1868 (#2229)
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