예제 #1
0
 /**
  * Creates a new collection
  *
  * @param MongoDB $db   - Parent database.
  * @param string  $name -
  *
  * @return - Returns a new collection object.
  */
 public function __construct(MongoDB $db, $name)
 {
     $this->db = $db;
     $this->name = $name;
     $this->fqn = $db->_getFullCollectionName($name);
     $this->client = $db->_getClient();
     $this->protocol = $this->client->_getProtocol();
 }
예제 #2
0
 /**
  * Creates a new collection
  *
  * @param MongoDB $db   - Parent database.
  * @param string  $name -
  *
  * @return - Returns a new collection object.
  */
 public function __construct(MongoDB $db, $name)
 {
     $this->db = $db;
     $this->name = $name;
     $this->readPreference = $db->getReadPreference();
     $this->fqn = $db->_getFullCollectionName($name);
     $this->client = $db->_getClient();
 }
예제 #3
0
 /**
  * Queries for files
  *
  * @param array $query - The query.
  * @param array $fields - Fields to return.
  * @return MongoGridFSCursor - A MongoGridFSCursor.
  */
 public function find(array $query = [], array $fields = [])
 {
     return new MongoGridFSCursor($this, $this->db->_getClient(), $this->__toString(), $query, $fields);
 }