| @@ 270-283 (lines=14) @@ | ||
| 267 | * @param array $options |
|
| 268 | * @return \MongoDB\Driver\Cursor |
|
| 269 | */ |
|
| 270 | public function findOneBy(array $filter = [], array $options = ['maxTimeMS' => 0]) |
|
| 271 | { |
|
| 272 | $this->validateQueryOptions($options); |
|
| 273 | ||
| 274 | $this->logger->info( |
|
| 275 | 'Find one ', |
|
| 276 | [ |
|
| 277 | 'query' => $filter, |
|
| 278 | 'col' => $this->name, |
|
| 279 | ] |
|
| 280 | ); |
|
| 281 | ||
| 282 | return $this->collection->findOne($filter, $options); |
|
| 283 | } |
|
| 284 | ||
| 285 | ||
| 286 | /** |
|
| @@ 291-304 (lines=14) @@ | ||
| 288 | * @param array $options |
|
| 289 | * @return null|object |
|
| 290 | */ |
|
| 291 | public function find($id, array $options = ['maxTimeMS' => 0]) |
|
| 292 | { |
|
| 293 | $this->validateQueryOptions($options); |
|
| 294 | ||
| 295 | $this->logger->info( |
|
| 296 | 'Mongo find by id', |
|
| 297 | [ |
|
| 298 | 'id' => $id, |
|
| 299 | 'col' => $this->name |
|
| 300 | ] |
|
| 301 | ); |
|
| 302 | ||
| 303 | return $this->collection->findOne([$this->getIdField() => self::createObjectId($id)], $options); |
|
| 304 | } |
|
| 305 | ||
| 306 | /** |
|
| 307 | * @param array $documents |
|