| @@ 702-714 (lines=13) @@ | ||
| 699 | /** |
|
| 700 | * @return \MongoDB\Collection |
|
| 701 | */ |
|
| 702 | private function createCollectionObject() |
|
| 703 | { |
|
| 704 | $options = [ |
|
| 705 | 'readPreference' => $this->readPreference, |
|
| 706 | 'writeConcern' => $this->writeConcern, |
|
| 707 | ]; |
|
| 708 | ||
| 709 | if ($this->collection === null) { |
|
| 710 | $this->collection = $this->db->getDb()->selectCollection($this->name, $options); |
|
| 711 | } else { |
|
| 712 | $this->collection = $this->collection->withOptions($options); |
|
| 713 | } |
|
| 714 | } |
|
| 715 | ||
| 716 | /** |
|
| 717 | * Converts legacy write concern options to a WriteConcern object |
|
| @@ 489-501 (lines=13) @@ | ||
| 486 | /** |
|
| 487 | * @return \MongoDB\Database |
|
| 488 | */ |
|
| 489 | private function createDatabaseObject() |
|
| 490 | { |
|
| 491 | $options = [ |
|
| 492 | 'readPreference' => $this->readPreference, |
|
| 493 | 'writeConcern' => $this->writeConcern, |
|
| 494 | ]; |
|
| 495 | ||
| 496 | if ($this->db === null) { |
|
| 497 | $this->db = $this->connection->getClient()->selectDatabase($this->name, $options); |
|
| 498 | } else { |
|
| 499 | $this->db = $this->db->withOptions($options); |
|
| 500 | } |
|
| 501 | } |
|
| 502 | } |
|
| 503 | ||