You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mongo-simple-aggregation-builder

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-simple-aggregation-builder - npm Package Compare versions

Comparing version

to
1.0.3

1

dist/builders/match.d.ts
import { Expression } from 'src/objects/expression';
export declare class MatchBuilder {
expression(expr: Expression): this & Expression;
match(fieldName: any, fieldValue: any): this;
}

@@ -8,4 +8,8 @@ "use strict";

}
match(fieldName, fieldValue) {
this[fieldName] = fieldValue;
return this;
}
}
exports.MatchBuilder = MatchBuilder;
//# sourceMappingURL=match.js.map

@@ -44,2 +44,9 @@ "use strict";

});
test('match', () => {
const expectResult = {
field_name: 'value',
};
const actualResult = new match_1.MatchBuilder().match('field_name', 'value');
expect(expectResult).toEqual(actualResult);
});
test('test structure', () => {

@@ -46,0 +53,0 @@ const query = [

2

package.json
{
"name": "mongo-simple-aggregation-builder",
"version": "1.0.2",
"version": "1.0.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -29,6 +29,20 @@ # mongo-simple-aggregation-builder

## Usage
```ts
import { Builder, FacetBuilder, GroupBuilder, MatchBuilder, ProjectBuilder } from 'mongo-simple-aggregation-builder'
```
const matchStage = new MatchBuilder().match('field_name', 'value');
const projectStage = new ProjectBuilder()
.includeField('field_name')
.addField('calculated_field', '$another_field');
const groupStage = new GroupBuilder('id')
.count('total')
.sum('aggregated_field', 'aggregated_val');
const pipeline = new Builder()
.match(matchStage)
.project(projectStage)
.group(groupStage)
.build();
```

@@ -35,0 +49,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet