| @@ 490-502 (lines=13) @@ | ||
| 487 | /** |
|
| 488 | * @return \MongoDB\Database |
|
| 489 | */ |
|
| 490 | private function createDatabaseObject() |
|
| 491 | { |
|
| 492 | $options = [ |
|
| 493 | 'readPreference' => $this->readPreference, |
|
| 494 | 'writeConcern' => $this->writeConcern, |
|
| 495 | ]; |
|
| 496 | ||
| 497 | if ($this->db === null) { |
|
| 498 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 499 | } else { |
|
| 500 | $this->db = $this->db->withOptions($options); |
|
| 501 | } |
|
| 502 | } |
|
| 503 | ||
| 504 | private function checkDatabaseName($name) |
|
| 505 | { |
|
| @@ 792-804 (lines=13) @@ | ||
| 789 | /** |
|
| 790 | * @return \MongoDB\Collection |
|
| 791 | */ |
|
| 792 | private function createCollectionObject() |
|
| 793 | { |
|
| 794 | $options = [ |
|
| 795 | 'readPreference' => $this->readPreference, |
|
| 796 | 'writeConcern' => $this->writeConcern, |
|
| 797 | ]; |
|
| 798 | ||
| 799 | if ($this->collection === null) { |
|
| 800 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 801 | } else { |
|
| 802 | $this->collection = $this->collection->withOptions($options); |
|
| 803 | } |
|
| 804 | } |
|
| 805 | ||
| 806 | /** |
|
| 807 | * Converts legacy write concern options to a WriteConcern object |
|