Skip to content

Commit

Permalink
Merge pull request #12278 from Automattic/gh-12269
Browse files Browse the repository at this point in the history
fix(types): allow $search in $lookup pipeline stages for MongoDB v6.x support
  • Loading branch information
AbdelrahmanHafez committed Aug 15, 2022
2 parents ffcdb40 + eff9d77 commit d11f809
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions test/types/PipelineStage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,3 +423,21 @@ const stages4: PipelineStage[] = [
}
};
})();


function gh12269() {
const lookup: PipelineStage.Lookup = {
$lookup: {
as: 'user',
from: 'users',
pipeline: [{
$search: {
index: 'users',
highlight: {
path: 'user.highlighted'
}
}
}]
}
};
}
2 changes: 1 addition & 1 deletion types/pipelinestage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ declare module 'mongoose' {
localField?: string
foreignField?: string
let?: Record<string, any>
pipeline?: Exclude<PipelineStage, PipelineStage.Merge | PipelineStage.Out | PipelineStage.Search>[]
pipeline?: Exclude<PipelineStage, PipelineStage.Merge | PipelineStage.Out>[]
}
}

Expand Down

0 comments on commit d11f809

Please sign in to comment.