Skip to content

Commit

Permalink
Added options parameters to insert and delete methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Rota committed Apr 23, 2020
1 parent 736415e commit be90aa3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Jenssegers/Mongodb/Query/Builder.php
Expand Up @@ -570,7 +570,7 @@ public function forPage($page, $perPage = 15)
/**
* @inheritdoc
*/
public function insert(array $values)
public function insert(array $values, array $options = [])
{
// Since every insert gets treated like a batch insert, we will have to detect
// if the user is inserting a single document or an array of documents.
Expand All @@ -590,7 +590,7 @@ public function insert(array $values)
}

// Batch insert
$result = $this->collection->insertMany($values);
$result = $this->collection->insertMany($values, $options);

return (1 == (int) $result->isAcknowledged());
}
Expand Down Expand Up @@ -692,7 +692,7 @@ public function pluck($column, $key = null)
/**
* @inheritdoc
*/
public function delete($id = null)
public function delete($id = null, array $options = [])
{
// If an ID is passed to the method, we will set the where clause to check
// the ID to allow developers to simply and quickly remove a single row
Expand All @@ -702,7 +702,7 @@ public function delete($id = null)
}

$wheres = $this->compileWheres();
$result = $this->collection->DeleteMany($wheres);
$result = $this->collection->DeleteMany($wheres, $options);
if (1 == (int) $result->isAcknowledged()) {
return $result->getDeletedCount();
}
Expand Down

0 comments on commit be90aa3

Please sign in to comment.