Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v1.x into v2.x #1563

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
submodules: true

- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
uses: mongodb-labs/drivers-evergreen-tools@81c6b49dd61e833229d750084f9f3c71b31acd8d
with:
version: ${{ matrix.mongodb-version }}
topology: ${{ matrix.topology }}
Expand Down
149 changes: 148 additions & 1 deletion generator/config/stage/search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ arguments:
name: count
optional: true
type:
- string
- object
description: |
Document that specifies the count options for retrieving a count of the results.
-
Expand Down Expand Up @@ -116,3 +116,150 @@ tests:
$replaceWith: '$$SEARCH_META'
-
$limit: 1
-
name: 'Date Search and Sort'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#date-search-and-sort'
pipeline:
-
$search:
range:
path: 'released'
gt: !bson_utcdatetime '2010-01-01T00:00:00.000Z'
lt: !bson_utcdatetime '2015-01-01T00:00:00.000Z'
sort:
released: -1
-
$limit: 5
-
$project:
_id: 0
title: 1
released: 1
-
name: 'Number Search and Sort'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#number-search-and-sort'
pipeline:
-
$search:
range:
path: 'awards.wins'
gt: 3
sort:
awards.wins: -1
-
$limit: 5
-
$project:
_id: 0
title: 1
awards.wins: 1
-
name: 'Sort by score'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#sort-by-score'
pipeline:
-
$search:
text:
path: 'title'
query: 'story'
sort:
score:
$meta: 'searchScore'
order: 1
-
$limit: 5
-
$project:
_id: 0
title: 1
score:
$meta: 'searchScore'
-
name: 'Paginate results after a token'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/paginate-results/#search-after-the-reference-point'
pipeline:
-
$search:
text:
path: 'title'
query: 'war'
sort:
score:
$meta: 'searchScore'
released: 1
searchAfter: 'CMtJGgYQuq+ngwgaCSkAjBYH7AAAAA=='
-
name: 'Paginate results before a token'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/paginate-results/#search-before-the-reference-point'
pipeline:
-
$search:
text:
path: 'title'
query: 'war'
sort:
score:
$meta: 'searchScore'
released: 1
searchBefore: 'CJ6kARoGELqvp4MIGgkpACDA3U8BAAA='
-
name: 'Count results'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/counting/#count-results'
pipeline:
-
$search:
near:
path: 'released'
origin: !bson_utcdatetime '2011-09-01T00:00:00.000+00:00'
pivot: 7776000000
count:
type: 'total'
-
$project:
meta: '$$SEARCH_META'
title: 1
released: 1
-
$limit: 2
-
name: 'Track Search terms'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/tracking/#examples'
pipeline:
-
$search:
text:
query: 'summer'
path: 'title'
tracking:
searchTerms: 'summer'
-
$limit: 5
-
$project:
_id: 0
title: 1
-
name: 'Return Stored Source Fields'
link: 'https://www.mongodb.com/docs/atlas/atlas-search/return-stored-source/#examples'
pipeline:
-
$search:
text:
query: 'baseball'
path: 'title'
returnStoredSource: true
-
$match:
$or:
-
imdb.rating:
$gt: 8.2
-
imdb.votes:
$gte: 4500
-
$lookup:
from: 'movies'
localField: '_id'
foreignField: '_id'
as: 'document'
4 changes: 2 additions & 2 deletions src/Builder/Stage/FactoryTrait.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Builder/Stage/FluentFactoryTrait.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/Builder/Stage/SearchStage.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading