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

How to use "allowDiskUse" in aggregationBuilder ? #1979

Closed
InternalServerError opened this issue Mar 13, 2019 · 2 comments
Closed

How to use "allowDiskUse" in aggregationBuilder ? #1979

InternalServerError opened this issue Mar 13, 2019 · 2 comments
Labels

Comments

@InternalServerError
Copy link

Q A
Version 3.4

Support Question

Hi,
Is it possible to use the allowDiskUse: true in aggregationBuilder please ?

@Steveb-p
Copy link
Contributor

Steveb-p commented Mar 13, 2019

You can pass $options when calling execute.

See execute method excerpt from 1.2/1.3:

/**
* {@inheritdoc}
*/
public function execute($options = [])
{
// Force cursor to be used
$options = array_merge($options, ['cursor' => true]);
$cursor = parent::execute($options);
return $this->prepareCursor($cursor);
}

Same method in 2.0 has the same signature and works the same way (roughly):

/**
* Executes the aggregation pipeline
*/
public function execute(array $options = []) : Iterator
{
// Force cursor to be used
$options = array_merge($options, ['cursor' => true]);
$cursor = $this->collection->aggregate($this->getPipeline(), $options);
assert($cursor instanceof Cursor);
return $this->prepareIterator($cursor);
}

@InternalServerError
Copy link
Author

You're a rockstar man, thank you for the quick and clear answer.
I did not see that, thanks again !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants