@entria/mongo-aggregate-lodash

0.0.1 • Public • Published

Mongo Aggregate Lodash

This package will make you write aggregate in a more terse way much like lodash utilities

How to install

yarn add @entria/mongo-aggregate-lodash

Examples

  • Without using mongo-aggregate-lodash
{
  $group: {
     averageDividend: {
        $sum: {
          $multiply: ['$score', '$field.weight'],
        }
    },
    averageDivisor: {
       $sum: '$field.weight'
    },
  }
}
  • Using mongo-aggregate-lodash
import { sum, multiply } from '@entria/mongo-aggregate-lodash';

{
  $group: {
     averageDividend: sum(multiply('$score', '$field.weight')),
      averageDivisor: sum('$field.weight'),
  }
}

Readme

Keywords

Package Sidebar

Install

npm i @entria/mongo-aggregate-lodash

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

13.2 kB

Total Files

9

Last publish

Collaborators

  • streeterxs
  • sibelius
  • rturk