| @@ 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 | { |
|
| @@ 863-875 (lines=13) @@ | ||
| 860 | /** |
|
| 861 | * @return \MongoDB\Collection |
|
| 862 | */ |
|
| 863 | private function createCollectionObject() |
|
| 864 | { |
|
| 865 | $options = [ |
|
| 866 | 'readPreference' => $this->readPreference, |
|
| 867 | 'writeConcern' => $this->writeConcern, |
|
| 868 | ]; |
|
| 869 | ||
| 870 | if ($this->collection === null) { |
|
| 871 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 872 | } else { |
|
| 873 | $this->collection = $this->collection->withOptions($options); |
|
| 874 | } |
|
| 875 | } |
|
| 876 | ||
| 877 | /** |
|
| 878 | * Converts legacy write concern options to a WriteConcern object |
|