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