| @@ 508-520 (lines=13) @@ | ||
| 505 | /** |
|
| 506 | * @return \MongoDB\Database |
|
| 507 | */ |
|
| 508 | private function createDatabaseObject() |
|
| 509 | { |
|
| 510 | $options = [ |
|
| 511 | 'readPreference' => $this->readPreference, |
|
| 512 | 'writeConcern' => $this->writeConcern, |
|
| 513 | ]; |
|
| 514 | ||
| 515 | if ($this->db === null) { |
|
| 516 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 517 | } else { |
|
| 518 | $this->db = $this->db->withOptions($options); |
|
| 519 | } |
|
| 520 | } |
|
| 521 | } |
|
| 522 | ||
| @@ 689-701 (lines=13) @@ | ||
| 686 | /** |
|
| 687 | * @return \MongoDB\Collection |
|
| 688 | */ |
|
| 689 | private function createCollectionObject() |
|
| 690 | { |
|
| 691 | $options = [ |
|
| 692 | 'readPreference' => $this->readPreference, |
|
| 693 | 'writeConcern' => $this->writeConcern, |
|
| 694 | ]; |
|
| 695 | ||
| 696 | if ($this->collection === null) { |
|
| 697 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 698 | } else { |
|
| 699 | $this->collection = $this->collection->withOptions($options); |
|
| 700 | } |
|
| 701 | } |
|
| 702 | } |
|
| 703 | ||
| 704 | ||