Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • T think-mongo
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 18
    • Issues 18
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • 刘晨
  • think-mongo
  • Merge requests
  • !35

新增multiAggregate,能够对多个字段进行聚合操作

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged 刘晨 requested to merge noprom:master into master May 09, 2017
  • Overview 0
  • Commits 4
  • Pipelines 0
  • Changes 2

Created by: noprom

新增multiAggregate,能够对多个字段进行聚合操作

用法:

$tableName = 'table_name';
Db::connect(config('mongo'))->name($tableName)
->multiAggregate(['sum' => 'field_sum', 'max' => 'study_date_year', 'min' => 'study_date_year'],
['tea_strength', 'tea_changes_per_day'];
# 可以产生如下类似mysql的查询效果
select `tea_strength`,  `tea_changes_per_day`, sum(`field_sum`), max(`study_date_year`), min(`study_date_year`) from `table_name` group by `tea_strength`, `tea_changes_per_day`;
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: noprom:master