| @@ 500-512 (lines=13) @@ | ||
| 497 | /** |
|
| 498 | * @return \MongoDB\Database |
|
| 499 | */ |
|
| 500 | private function createDatabaseObject() |
|
| 501 | { |
|
| 502 | $options = [ |
|
| 503 | 'readPreference' => $this->readPreference, |
|
| 504 | 'writeConcern' => $this->writeConcern, |
|
| 505 | ]; |
|
| 506 | ||
| 507 | if ($this->db === null) { |
|
| 508 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 509 | } else { |
|
| 510 | $this->db = $this->db->withOptions($options); |
|
| 511 | } |
|
| 512 | } |
|
| 513 | ||
| 514 | private function checkDatabaseName($name) |
|
| 515 | { |
|
| @@ 869-881 (lines=13) @@ | ||
| 866 | /** |
|
| 867 | * @return \MongoDB\Collection |
|
| 868 | */ |
|
| 869 | private function createCollectionObject() |
|
| 870 | { |
|
| 871 | $options = [ |
|
| 872 | 'readPreference' => $this->readPreference, |
|
| 873 | 'writeConcern' => $this->writeConcern, |
|
| 874 | ]; |
|
| 875 | ||
| 876 | if ($this->collection === null) { |
|
| 877 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 878 | } else { |
|
| 879 | $this->collection = $this->collection->withOptions($options); |
|
| 880 | } |
|
| 881 | } |
|
| 882 | ||
| 883 | /** |
|
| 884 | * Converts legacy write concern options to a WriteConcern object |
|