| @@ 768-780 (lines=13) @@ | ||
| 765 | /** |
|
| 766 | * @return \MongoDB\Collection |
|
| 767 | */ |
|
| 768 | private function createCollectionObject() |
|
| 769 | { |
|
| 770 | $options = [ |
|
| 771 | 'readPreference' => $this->readPreference, |
|
| 772 | 'writeConcern' => $this->writeConcern, |
|
| 773 | ]; |
|
| 774 | ||
| 775 | if ($this->collection === null) { |
|
| 776 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 777 | } else { |
|
| 778 | $this->collection = $this->collection->withOptions($options); |
|
| 779 | } |
|
| 780 | } |
|
| 781 | ||
| 782 | /** |
|
| 783 | * Converts legacy write concern options to a WriteConcern object |
|
| @@ 490-502 (lines=13) @@ | ||
| 487 | /** |
|
| 488 | * @return \MongoDB\Database |
|
| 489 | */ |
|
| 490 | private function createDatabaseObject() |
|
| 491 | { |
|
| 492 | $options = [ |
|
| 493 | 'readPreference' => $this->readPreference, |
|
| 494 | 'writeConcern' => $this->writeConcern, |
|
| 495 | ]; |
|
| 496 | ||
| 497 | if ($this->db === null) { |
|
| 498 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 499 | } else { |
|
| 500 | $this->db = $this->db->withOptions($options); |
|
| 501 | } |
|
| 502 | } |
|
| 503 | ||
| 504 | private function checkDatabaseName($name) |
|
| 505 | { |
|