| @@ 673-685 (lines=13) @@ | ||
| 670 | /** |
|
| 671 | * @return \MongoDB\Collection |
|
| 672 | */ |
|
| 673 | private function createCollectionObject() |
|
| 674 | { |
|
| 675 | $options = [ |
|
| 676 | 'readPreference' => $this->readPreference, |
|
| 677 | 'writeConcern' => $this->writeConcern, |
|
| 678 | ]; |
|
| 679 | ||
| 680 | if ($this->collection === null) { |
|
| 681 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 682 | } else { |
|
| 683 | $this->collection = $this->collection->withOptions($options); |
|
| 684 | } |
|
| 685 | } |
|
| 686 | ||
| 687 | /** |
|
| 688 | * @param array $options |
|
| @@ 465-477 (lines=13) @@ | ||
| 462 | /** |
|
| 463 | * @return \MongoDB\Database |
|
| 464 | */ |
|
| 465 | private function createDatabaseObject() |
|
| 466 | { |
|
| 467 | $options = [ |
|
| 468 | 'readPreference' => $this->readPreference, |
|
| 469 | 'writeConcern' => $this->writeConcern, |
|
| 470 | ]; |
|
| 471 | ||
| 472 | if ($this->db === null) { |
|
| 473 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 474 | } else { |
|
| 475 | $this->db = $this->db->withOptions($options); |
|
| 476 | } |
|
| 477 | } |
|
| 478 | } |
|
| 479 | ||