如何添加选项";AllowDiskUse:true“;在使用Api平台的Mongodb请求中?
本项目使用Api平台和mongodb。 我有一个按姓氏排序的播放器文档。有5000名玩家,它可以工作。 当我测试200000名玩家时,我有一个错误: 排序超出了104857600字节的内存限制,但未选择加入 外部排序。正在中止操作。Pass allowDiskUse:对opt为真 在 我需要在请求的选项中添加“allowDiskUse:true” 我试着将它直接添加到ApiPlatform代码中进行测试,结果很好!(但我无法将其添加到库中) 我的问题是:如何在使用Api平台的mongodb查询中添加选项“allowDiskUse:true”如何添加选项";AllowDiskUse:true“;在使用Api平台的Mongodb请求中?,mongodb,symfony,doctrine-odm,api-platform.com,Mongodb,Symfony,Doctrine Odm,Api Platform.com,本项目使用Api平台和mongodb。 我有一个按姓氏排序的播放器文档。有5000名玩家,它可以工作。 当我测试200000名玩家时,我有一个错误: 排序超出了104857600字节的内存限制,但未选择加入 外部排序。正在中止操作。Pass allowDiskUse:对opt为真 在 我需要在请求的选项中添加“allowDiskUse:true” 我试着将它直接添加到ApiPlatform代码中进行测试,结果很好!(但我无法将其添加到库中) 我的问题是:如何在使用Api平台的mongodb查询中
/**
* @ODM\Document(repositoryClass="App\Repository\PlayerRepository")
* @ApiResource(
* attributes={"orders"={"lastName"= "ASC"}},
* collectionOperations={"get", "post"},
* itemOperations={"get", "put"},
*
* normalizationContext={"groups"={"player"}},
* denormalizationContext={"groups"={"player"}}
* )
*/
class Player
{
/**
* @ODM\Id
* @Groups({"player"})
*/
private $id;
/**
* @ODM\Field(type="string")
* @Groups({"player"})
*/
private $optaId;
/**
* @ODM\Field(type="string")
* @Groups({"player"})
*/
private $firstName;
/**
* @ODM\Field(type="string")
* @Groups({"player"})
*/
private $lastName;
您可以通过添加
* @ApiResource(attributes={
* "doctrine_mongodb"={
* "execute_options"={
* "allowDiskUse"=true
* }
* }
* })