Skip to content

Commit 981dd44

Browse files
Merge v1.x into v2.x (#1563)
2 parents 0dce47c + fb692ca commit 981dd44

File tree

8 files changed

+658
-11
lines changed

8 files changed

+658
-11
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
submodules: true
6666

6767
- id: setup-mongodb
68-
uses: mongodb-labs/drivers-evergreen-tools@master
68+
uses: mongodb-labs/drivers-evergreen-tools@81c6b49dd61e833229d750084f9f3c71b31acd8d
6969
with:
7070
version: ${{ matrix.mongodb-version }}
7171
topology: ${{ matrix.topology }}

generator/config/stage/search.yaml

+148-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ arguments:
4545
name: count
4646
optional: true
4747
type:
48-
- string
48+
- object
4949
description: |
5050
Document that specifies the count options for retrieving a count of the results.
5151
-
@@ -116,3 +116,150 @@ tests:
116116
$replaceWith: '$$SEARCH_META'
117117
-
118118
$limit: 1
119+
-
120+
name: 'Date Search and Sort'
121+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#date-search-and-sort'
122+
pipeline:
123+
-
124+
$search:
125+
range:
126+
path: 'released'
127+
gt: !bson_utcdatetime '2010-01-01T00:00:00.000Z'
128+
lt: !bson_utcdatetime '2015-01-01T00:00:00.000Z'
129+
sort:
130+
released: -1
131+
-
132+
$limit: 5
133+
-
134+
$project:
135+
_id: 0
136+
title: 1
137+
released: 1
138+
-
139+
name: 'Number Search and Sort'
140+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#number-search-and-sort'
141+
pipeline:
142+
-
143+
$search:
144+
range:
145+
path: 'awards.wins'
146+
gt: 3
147+
sort:
148+
awards.wins: -1
149+
-
150+
$limit: 5
151+
-
152+
$project:
153+
_id: 0
154+
title: 1
155+
awards.wins: 1
156+
-
157+
name: 'Sort by score'
158+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#sort-by-score'
159+
pipeline:
160+
-
161+
$search:
162+
text:
163+
path: 'title'
164+
query: 'story'
165+
sort:
166+
score:
167+
$meta: 'searchScore'
168+
order: 1
169+
-
170+
$limit: 5
171+
-
172+
$project:
173+
_id: 0
174+
title: 1
175+
score:
176+
$meta: 'searchScore'
177+
-
178+
name: 'Paginate results after a token'
179+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/paginate-results/#search-after-the-reference-point'
180+
pipeline:
181+
-
182+
$search:
183+
text:
184+
path: 'title'
185+
query: 'war'
186+
sort:
187+
score:
188+
$meta: 'searchScore'
189+
released: 1
190+
searchAfter: 'CMtJGgYQuq+ngwgaCSkAjBYH7AAAAA=='
191+
-
192+
name: 'Paginate results before a token'
193+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/paginate-results/#search-before-the-reference-point'
194+
pipeline:
195+
-
196+
$search:
197+
text:
198+
path: 'title'
199+
query: 'war'
200+
sort:
201+
score:
202+
$meta: 'searchScore'
203+
released: 1
204+
searchBefore: 'CJ6kARoGELqvp4MIGgkpACDA3U8BAAA='
205+
-
206+
name: 'Count results'
207+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/counting/#count-results'
208+
pipeline:
209+
-
210+
$search:
211+
near:
212+
path: 'released'
213+
origin: !bson_utcdatetime '2011-09-01T00:00:00.000+00:00'
214+
pivot: 7776000000
215+
count:
216+
type: 'total'
217+
-
218+
$project:
219+
meta: '$$SEARCH_META'
220+
title: 1
221+
released: 1
222+
-
223+
$limit: 2
224+
-
225+
name: 'Track Search terms'
226+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/tracking/#examples'
227+
pipeline:
228+
-
229+
$search:
230+
text:
231+
query: 'summer'
232+
path: 'title'
233+
tracking:
234+
searchTerms: 'summer'
235+
-
236+
$limit: 5
237+
-
238+
$project:
239+
_id: 0
240+
title: 1
241+
-
242+
name: 'Return Stored Source Fields'
243+
link: 'https://www.mongodb.com/docs/atlas/atlas-search/return-stored-source/#examples'
244+
pipeline:
245+
-
246+
$search:
247+
text:
248+
query: 'baseball'
249+
path: 'title'
250+
returnStoredSource: true
251+
-
252+
$match:
253+
$or:
254+
-
255+
imdb.rating:
256+
$gt: 8.2
257+
-
258+
imdb.votes:
259+
$gte: 4500
260+
-
261+
$lookup:
262+
from: 'movies'
263+
localField: '_id'
264+
foreignField: '_id'
265+
as: 'document'

src/Builder/Stage/FactoryTrait.php

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Stage/FluentFactoryTrait.php

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Stage/SearchStage.php

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)