Commit 664b5454 authored by Hannes Magnusson's avatar Hannes Magnusson

folding

parent bb17999f
<?php <?php
namespace MongoDB; namespace MongoDB;
/* phongo includes */ /* {{{ phongo includes */
use MongoDB\Manager; use MongoDB\Manager;
use MongoDB\Query; use MongoDB\Query;
use MongoDB\Command; use MongoDB\Command;
...@@ -10,8 +10,10 @@ use MongoDB\WriteBatch; ...@@ -10,8 +10,10 @@ use MongoDB\WriteBatch;
use MongoDB\QueryFlags; use MongoDB\QueryFlags;
use MongoDB\CursorType; use MongoDB\CursorType;
/* }}} */
class Collection { class Collection {
/* {{{ consts & vars */
const INSERT = 0x01; const INSERT = 0x01;
const UPDATE = 0x02; const UPDATE = 0x02;
const DELETE = 0x04; const DELETE = 0x04;
...@@ -23,13 +25,16 @@ class Collection { ...@@ -23,13 +25,16 @@ class Collection {
protected $dbname; protected $dbname;
protected $collname; protected $collname;
function __construct(Manager $manager, $ns, WriteConcern $wc = null, ReadPreference $rp = null) { /* }}} */
function __construct(Manager $manager, $ns, WriteConcern $wc = null, ReadPreference $rp = null) { /* {{{ */
$this->manager = $manager; $this->manager = $manager;
$this->ns = $ns; $this->ns = $ns;
$this->wc = $wc; $this->wc = $wc;
$this->rp = $rp; $this->rp = $rp;
list($this->dbname, $this->collname) = explode(".", $ns, 2); list($this->dbname, $this->collname) = explode(".", $ns, 2);
} } /* }}} */
function find(array $filter = array(), array $options = array()) { /* {{{ {{{ */ function find(array $filter = array(), array $options = array()) { /* {{{ {{{ */
$options = array_merge($this->getFindOptions(), $options); $options = array_merge($this->getFindOptions(), $options);
...@@ -350,14 +355,15 @@ class Collection { ...@@ -350,14 +355,15 @@ class Collection {
/* FIXME: Add a version check for useCursor */ /* FIXME: Add a version check for useCursor */
return $opts; return $opts;
} /* }}} */ } /* }}} */
protected function _massageAggregateOptions($options) { protected function _massageAggregateOptions($options) { /* {{{ */
if ($options["useCursor"]) { if ($options["useCursor"]) {
$options["cursor"] = array("batchSize" => $options["batchSize"]); $options["cursor"] = array("batchSize" => $options["batchSize"]);
} }
unset($options["useCursor"], $options["batchSize"]); unset($options["useCursor"], $options["batchSize"]);
return $options; return $options;
} } /* }}} */
protected function _generateCommandException($doc) { /* {{{ */ protected function _generateCommandException($doc) { /* {{{ */
if ($doc["errmsg"]) { if ($doc["errmsg"]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment