/** * 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(); }
/** * 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(); }
/** * 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); }