| @@ 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 | ||
| @@ 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 | ||