| @@ 543-555 (lines=13) @@ | ||
| 540 | /** |
|
| 541 | * @return \MongoDB\Collection |
|
| 542 | */ |
|
| 543 | private function createCollectionObject() |
|
| 544 | { |
|
| 545 | $options = [ |
|
| 546 | 'readPreference' => $this->readPreference, |
|
| 547 | 'writeConcern' => $this->writeConcern, |
|
| 548 | ]; |
|
| 549 | ||
| 550 | if ($this->collection === null) { |
|
| 551 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 552 | } else { |
|
| 553 | $this->collection = $this->collection->withOptions($options); |
|
| 554 | } |
|
| 555 | } |
|
| 556 | } |
|
| 557 | ||
| 558 | ||
| @@ 498-510 (lines=13) @@ | ||
| 495 | /** |
|
| 496 | * @return \MongoDB\Database |
|
| 497 | */ |
|
| 498 | private function createDatabaseObject() |
|
| 499 | { |
|
| 500 | $options = [ |
|
| 501 | 'readPreference' => $this->readPreference, |
|
| 502 | 'writeConcern' => $this->writeConcern, |
|
| 503 | ]; |
|
| 504 | ||
| 505 | if ($this->db === null) { |
|
| 506 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 507 | } else { |
|
| 508 | $this->db = $this->db->withOptions($options); |
|
| 509 | } |
|
| 510 | } |
|
| 511 | } |
|
| 512 | ||