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