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