| @@ 814-826 (lines=13) @@ | ||
| 811 | /** |
|
| 812 | * @return \MongoDB\Collection |
|
| 813 | */ |
|
| 814 | private function createCollectionObject() |
|
| 815 | { |
|
| 816 | $options = [ |
|
| 817 | 'readPreference' => $this->readPreference, |
|
| 818 | 'writeConcern' => $this->writeConcern, |
|
| 819 | ]; |
|
| 820 | ||
| 821 | if ($this->collection === null) { |
|
| 822 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 823 | } else { |
|
| 824 | $this->collection = $this->collection->withOptions($options); |
|
| 825 | } |
|
| 826 | } |
|
| 827 | ||
| 828 | /** |
|
| 829 | * Converts legacy write concern options to a WriteConcern object |
|
| @@ 486-498 (lines=13) @@ | ||
| 483 | /** |
|
| 484 | * @return \MongoDB\Database |
|
| 485 | */ |
|
| 486 | private function createDatabaseObject() |
|
| 487 | { |
|
| 488 | $options = [ |
|
| 489 | 'readPreference' => $this->readPreference, |
|
| 490 | 'writeConcern' => $this->writeConcern, |
|
| 491 | ]; |
|
| 492 | ||
| 493 | if ($this->db === null) { |
|
| 494 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 495 | } else { |
|
| 496 | $this->db = $this->db->withOptions($options); |
|
| 497 | } |
|
| 498 | } |
|
| 499 | ||
| 500 | private function checkDatabaseName($name) |
|
| 501 | { |
|