Skip to content

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.

@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.

3 participants