Пример #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
 /**
  * Create a new cursor
  *
  * @param mongoclient $connection - Database connection.
  * @param string      $ns         - Full name of database and collection.
  * @param array       $query      - Database query.
  * @param array       $fields     - Fields to return.
  *
  * @return - Returns the new cursor.
  */
 public function __construct(MongoClient $connection, $ns, array $query = [], array $fields = [])
 {
     $this->client = $connection;
     $this->protocol = $connection->_getProtocol();
     $this->fcn = $ns;
     $this->fields = $fields;
     $this->query['$query'] = $query;
     $this->queryTimeout = self::$timeout;
 }
Пример #3
0
 /**
  * Creates a new database
  *
  * @param mongoclient $conn - Database connection.
  * @param string $name - Database name.
  *
  * @return  - Returns the database.
  */
 public function __construct(MongoClient $client, $name)
 {
     $this->name = $name;
     $this->client = $client;
     $this->protocol = $client->_getProtocol();
 }