You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/mongodb.md
+64Lines changed: 64 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -214,3 +214,67 @@ See how to use them and how to create custom ones in the [filters documentation]
214
214
## Creating Custom Extensions
215
215
216
216
See how to create Doctrine MongoDB ODM custom extensions in the [extensions documentation](extensions.md).
217
+
218
+
## Adding Execute Options
219
+
220
+
If you want to add some command options when executing an aggregate query (see the [related documentation in MongoDB manual](https://docs.mongodb.com/manual/reference/command/aggregate/#command-fields)),
221
+
you can do it in your resource configuration, at the operation or the resource level.
222
+
223
+
For instance at the operation level:
224
+
225
+
```php
226
+
<?php
227
+
// api/src/Document/Offer.php
228
+
229
+
namespace App\Document;
230
+
231
+
use ApiPlatform\Core\Annotation\ApiResource;
232
+
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
233
+
234
+
/**
235
+
* @ApiResource(attributes={
236
+
* collectionOperations={
237
+
* "get"={
238
+
* "method"="GET",
239
+
* "doctrine_mongodb"={
240
+
* "execute_options"={
241
+
* "allowDiskUse"=true
242
+
* }
243
+
* }
244
+
* }
245
+
* }
246
+
* })
247
+
* @ODM\Document
248
+
*/
249
+
class Offer
250
+
{
251
+
// ...
252
+
}
253
+
```
254
+
255
+
Or at the resource level:
256
+
257
+
```php
258
+
<?php
259
+
// api/src/Document/Offer.php
260
+
261
+
namespace App\Document;
262
+
263
+
use ApiPlatform\Core\Annotation\ApiResource;
264
+
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
0 commit comments