| @@ 624-636 (lines=13) @@ | ||
| 621 | /** |
|
| 622 | * @return \MongoDB\Collection |
|
| 623 | */ |
|
| 624 | private function createCollectionObject() |
|
| 625 | { |
|
| 626 | $options = [ |
|
| 627 | 'readPreference' => $this->readPreference, |
|
| 628 | 'writeConcern' => $this->writeConcern, |
|
| 629 | ]; |
|
| 630 | ||
| 631 | if ($this->collection === null) { |
|
| 632 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 633 | } else { |
|
| 634 | $this->collection = $this->collection->withOptions($options); |
|
| 635 | } |
|
| 636 | } |
|
| 637 | } |
|
| 638 | ||
| 639 | ||
| @@ 483-495 (lines=13) @@ | ||
| 480 | /** |
|
| 481 | * @return \MongoDB\Database |
|
| 482 | */ |
|
| 483 | private function createDatabaseObject() |
|
| 484 | { |
|
| 485 | $options = [ |
|
| 486 | 'readPreference' => $this->readPreference, |
|
| 487 | 'writeConcern' => $this->writeConcern, |
|
| 488 | ]; |
|
| 489 | ||
| 490 | if ($this->db === null) { |
|
| 491 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 492 | } else { |
|
| 493 | $this->db = $this->db->withOptions($options); |
|
| 494 | } |
|
| 495 | } |
|
| 496 | } |
|
| 497 | ||