Skip to content

Commit

Permalink
Revert "try undoing $fill to see if that fixes benchmark"
Browse files Browse the repository at this point in the history
This reverts commit bb803b7.
  • Loading branch information
vkarpov15 committed Dec 8, 2022
1 parent bb803b7 commit 5c92365
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion types/aggregate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ declare module 'mongoose' {
facet(options: PipelineStage.Facet['$facet']): this;

/** Appends a new $fill operator to this aggregate pipeline */
//fill(arg: PipelineStage.Fill['$fill']): this;
fill(arg: PipelineStage.Fill['$fill']): this;

/** Appends new custom $graphLookup operator(s) to this aggregate pipeline, performing a recursive search on a collection. */
graphLookup(options: PipelineStage.GraphLookup['$graphLookup']): this;
Expand Down
22 changes: 22 additions & 0 deletions types/expressions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,26 @@ declare module 'mongoose' {
$last: Expression;
}

export interface LinearFill {
/**
* Fills null and missing fields in a window using linear interpolation based on surrounding field values.
*
* @version 5.3
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill
*/
$linearFill: Expression
}

export interface Locf {
/**
* Last observation carried forward. Sets values for null and missing fields in a window to the last non-null value for the field.
*
* @version 5.2
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/locf
*/
$locf: Expression
}

export interface Map {
/**
* Applies a subexpression to each element of an array and returns the array of resulting values in order. Accepts named parameters.
Expand Down Expand Up @@ -2745,6 +2765,8 @@ declare module 'mongoose' {
Expression.First |
Expression.Integral |
Expression.Last |
Expression.LinearFill |
Expression.Locf |
Expression.Max |
Expression.Min |
Expression.Push |
Expand Down
14 changes: 13 additions & 1 deletion types/pipelinestage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ declare module 'mongoose' {
| PipelineStage.BucketAuto
| PipelineStage.CollStats
| PipelineStage.Count
| PipelineStage.Densify
| PipelineStage.Facet
| PipelineStage.Fill
| PipelineStage.GeoNear
| PipelineStage.GraphLookup
| PipelineStage.Group
Expand Down Expand Up @@ -89,6 +91,16 @@ declare module 'mongoose' {
}
}

export interface Fill {
/** [`$fill` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/fill/) */
$fill: {
partitionBy?: Expression,
partitionByFields?: string[],
sortBy?: Record<string, 1 | -1>,
output: Record<string, { value: Expression } | { method: 'linear' | 'locf' }>
}
}

export interface Facet {
/** [`$facet` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/facet/) */
$facet: Record<string, FacetPipelineStage[]>;
Expand Down Expand Up @@ -201,7 +213,7 @@ declare module 'mongoose' {

export interface ReplaceWith {
/** [`$replaceWith` reference](https://docs.mongodb.com/manual/reference/operator/aggregation/replaceWith/) */
$replaceWith: ObjectExpressionOperator;
$replaceWith: ObjectExpressionOperator | { [field: string]: Expression } | `$${string}`;
}

export interface Sample {
Expand Down

0 comments on commit 5c92365

Please sign in to comment.