| @@ 489-501 (lines=13) @@ | ||
| 486 | /** |
|
| 487 | * @return \MongoDB\Database |
|
| 488 | */ |
|
| 489 | private function createDatabaseObject() |
|
| 490 | { |
|
| 491 | $options = [ |
|
| 492 | 'readPreference' => $this->readPreference, |
|
| 493 | 'writeConcern' => $this->writeConcern, |
|
| 494 | ]; |
|
| 495 | ||
| 496 | if ($this->db === null) { |
|
| 497 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 498 | } else { |
|
| 499 | $this->db = $this->db->withOptions($options); |
|
| 500 | } |
|
| 501 | } |
|
| 502 | } |
|
| 503 | ||
| @@ 771-783 (lines=13) @@ | ||
| 768 | /** |
|
| 769 | * @return \MongoDB\Collection |
|
| 770 | */ |
|
| 771 | private function createCollectionObject() |
|
| 772 | { |
|
| 773 | $options = [ |
|
| 774 | 'readPreference' => $this->readPreference, |
|
| 775 | 'writeConcern' => $this->writeConcern, |
|
| 776 | ]; |
|
| 777 | ||
| 778 | if ($this->collection === null) { |
|
| 779 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 780 | } else { |
|
| 781 | $this->collection = $this->collection->withOptions($options); |
|
| 782 | } |
|
| 783 | } |
|
| 784 | ||
| 785 | /** |
|
| 786 | * Converts legacy write concern options to a WriteConcern object |
|