Socket
Socket
Sign inDemoInstall

mongo-simple-aggregation-builder

Package Overview
Dependencies
39
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc