| @@ 931-943 (lines=13) @@ | ||
| 928 | /** |
|
| 929 | * @return \MongoDB\Collection |
|
| 930 | */ |
|
| 931 | private function createCollectionObject() |
|
| 932 | { |
|
| 933 | $options = [ |
|
| 934 | 'readPreference' => $this->readPreference, |
|
| 935 | 'writeConcern' => $this->writeConcern, |
|
| 936 | ]; |
|
| 937 | ||
| 938 | if ($this->collection === null) { |
|
| 939 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 940 | } else { |
|
| 941 | $this->collection = $this->collection->withOptions($options); |
|
| 942 | } |
|
| 943 | } |
|
| 944 | ||
| 945 | /** |
|
| 946 | * Converts legacy write concern options to a WriteConcern object |
|
| @@ 505-517 (lines=13) @@ | ||
| 502 | /** |
|
| 503 | * @return \MongoDB\Database |
|
| 504 | */ |
|
| 505 | private function createDatabaseObject() |
|
| 506 | { |
|
| 507 | $options = [ |
|
| 508 | 'readPreference' => $this->readPreference, |
|
| 509 | 'writeConcern' => $this->writeConcern, |
|
| 510 | ]; |
|
| 511 | ||
| 512 | if ($this->db === null) { |
|
| 513 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 514 | } else { |
|
| 515 | $this->db = $this->db->withOptions($options); |
|
| 516 | } |
|
| 517 | } |
|
| 518 | ||
| 519 | private function checkDatabaseName($name) |
|
| 520 | { |
|