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