@@ 467-479 (lines=13) @@ | ||
464 | /** |
|
465 | * @return \MongoDB\Database |
|
466 | */ |
|
467 | private function createDatabaseObject() |
|
468 | { |
|
469 | $options = [ |
|
470 | 'readPreference' => $this->readPreference, |
|
471 | 'writeConcern' => $this->writeConcern, |
|
472 | ]; |
|
473 | ||
474 | if ($this->db === null) { |
|
475 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
476 | } else { |
|
477 | $this->db = $this->db->withOptions($options); |
|
478 | } |
|
479 | } |
|
480 | } |
|
481 |
@@ 705-717 (lines=13) @@ | ||
702 | /** |
|
703 | * @return \MongoDB\Collection |
|
704 | */ |
|
705 | private function createCollectionObject() |
|
706 | { |
|
707 | $options = [ |
|
708 | 'readPreference' => $this->readPreference, |
|
709 | 'writeConcern' => $this->writeConcern, |
|
710 | ]; |
|
711 | ||
712 | if ($this->collection === null) { |
|
713 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
714 | } else { |
|
715 | $this->collection = $this->collection->withOptions($options); |
|
716 | } |
|
717 | } |
|
718 | ||
719 | /** |
|
720 | * Converts legacy write concern options to a WriteConcern object |