| @@ 516-528 (lines=13) @@ | ||
| 513 | /** |
|
| 514 | * @return \MongoDB\Database |
|
| 515 | */ |
|
| 516 | private function createDatabaseObject() |
|
| 517 | { |
|
| 518 | $options = [ |
|
| 519 | 'readPreference' => $this->readPreference, |
|
| 520 | 'writeConcern' => $this->writeConcern, |
|
| 521 | ]; |
|
| 522 | ||
| 523 | if ($this->db === null) { |
|
| 524 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 525 | } else { |
|
| 526 | $this->db = $this->db->withOptions($options); |
|
| 527 | } |
|
| 528 | } |
|
| 529 | ||
| 530 | private function checkDatabaseName($name) |
|
| 531 | { |
|
| @@ 938-950 (lines=13) @@ | ||
| 935 | /** |
|
| 936 | * @return \MongoDB\Collection |
|
| 937 | */ |
|
| 938 | private function createCollectionObject() |
|
| 939 | { |
|
| 940 | $options = [ |
|
| 941 | 'readPreference' => $this->readPreference, |
|
| 942 | 'writeConcern' => $this->writeConcern, |
|
| 943 | ]; |
|
| 944 | ||
| 945 | if ($this->collection === null) { |
|
| 946 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 947 | } else { |
|
| 948 | $this->collection = $this->collection->withOptions($options); |
|
| 949 | } |
|
| 950 | } |
|
| 951 | ||
| 952 | /** |
|
| 953 | * Converts legacy write concern options to a WriteConcern object |
|