| @@ 846-858 (lines=13) @@ | ||
| 843 | /** |
|
| 844 | * @return \MongoDB\Collection |
|
| 845 | */ |
|
| 846 | private function createCollectionObject() |
|
| 847 | { |
|
| 848 | $options = [ |
|
| 849 | 'readPreference' => $this->readPreference, |
|
| 850 | 'writeConcern' => $this->writeConcern, |
|
| 851 | ]; |
|
| 852 | ||
| 853 | if ($this->collection === null) { |
|
| 854 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 855 | } else { |
|
| 856 | $this->collection = $this->collection->withOptions($options); |
|
| 857 | } |
|
| 858 | } |
|
| 859 | ||
| 860 | /** |
|
| 861 | * Converts legacy write concern options to a WriteConcern object |
|
| @@ 484-496 (lines=13) @@ | ||
| 481 | /** |
|
| 482 | * @return \MongoDB\Database |
|
| 483 | */ |
|
| 484 | private function createDatabaseObject() |
|
| 485 | { |
|
| 486 | $options = [ |
|
| 487 | 'readPreference' => $this->readPreference, |
|
| 488 | 'writeConcern' => $this->writeConcern, |
|
| 489 | ]; |
|
| 490 | ||
| 491 | if ($this->db === null) { |
|
| 492 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 493 | } else { |
|
| 494 | $this->db = $this->db->withOptions($options); |
|
| 495 | } |
|
| 496 | } |
|
| 497 | ||
| 498 | private function checkDatabaseName($name) |
|
| 499 | { |
|