Skip to content

Commit 2e165cc

Browse files
committed
Small tweaks
1 parent 0aea1ff commit 2e165cc

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/Jenssegers/Mongodb/Builder.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Builder extends \Illuminate\Database\Query\Builder {
88
/**
99
* The database collection
1010
*
11-
* @var string
11+
* @var MongoCollection
1212
*/
1313
public $collection;
1414

@@ -247,8 +247,6 @@ public function whereBetween($column, array $values, $boolean = 'and')
247247

248248
$this->wheres[] = compact('column', 'type', 'boolean', 'values');
249249

250-
$this->bindings = array_merge($this->bindings, $values);
251-
252250
return $this;
253251
}
254252

@@ -366,8 +364,7 @@ public function decrement($column, $amount = 1, array $extra = array())
366364
*/
367365
public function delete($id = null)
368366
{
369-
$query = $this->compileWheres();
370-
$result = $this->collection->remove($query);
367+
$result = $this->collection->remove($this->compileWheres());
371368

372369
if (1 == (int) $result['ok'])
373370
{
@@ -405,6 +402,16 @@ public function truncate()
405402
return (1 == (int) $result['ok']);
406403
}
407404

405+
/**
406+
* Get a new instance of the query builder.
407+
*
408+
* @return Builder
409+
*/
410+
public function newQuery()
411+
{
412+
return new Builder($this->connection);
413+
}
414+
408415
/**
409416
* Compile the where array
410417
*
@@ -414,6 +421,7 @@ private function compileWheres()
414421
{
415422
if (!$this->wheres) return array();
416423

424+
// The new list of compiled wheres
417425
$wheres = array();
418426

419427
foreach ($this->wheres as $i=>&$where)
@@ -535,14 +543,4 @@ private function compileWherebetween($where)
535543
);
536544
}
537545

538-
/**
539-
* Get a new instance of the query builder.
540-
*
541-
* @return Builder
542-
*/
543-
public function newQuery()
544-
{
545-
return new Builder($this->connection);
546-
}
547-
548546
}

0 commit comments

Comments
 (0)