/**
  * Creates a new collection
  *
  * @link http://www.php.net/manual/en/mongocollection.construct.php
  * @param MongoDB $db Parent database.
  * @param string $name Name for this collection.
  * @throws Exception
  * @return MongoCollection
  */
 public function __construct(MongoDB $db, $name)
 {
     $this->db = $db;
     $this->name = $name;
     $this->setReadPreferenceFromArray($db->getReadPreference());
     $this->setWriteConcernFromArray($db->getWriteConcern());
     $this->createCollectionObject();
 }
Exemple #2
0
 /**
  * Get current write concern
  * May be used only if mongo extension version >=1.5
  *
  * @return mixed
  */
 public function getWriteConcern()
 {
     return $this->mongoDB->getWriteConcern();
 }