@@ 258-271 (lines=14) @@ | ||
255 | * @param array $options |
|
256 | * @return \MongoDB\Driver\Cursor |
|
257 | */ |
|
258 | public function findOneBy(array $filter = [], array $options = ['maxTimeMS' => 0]) |
|
259 | { |
|
260 | $this->validateQueryOptions($options); |
|
261 | ||
262 | $this->logger->info( |
|
263 | 'Find one ', |
|
264 | [ |
|
265 | 'query' => $filter, |
|
266 | 'col' => $this->name, |
|
267 | ] |
|
268 | ); |
|
269 | ||
270 | return $this->collection->findOne($filter, $options); |
|
271 | } |
|
272 | ||
273 | ||
274 | /** |
|
@@ 279-292 (lines=14) @@ | ||
276 | * @param array $options |
|
277 | * @return null|object |
|
278 | */ |
|
279 | public function find($id, array $options = ['maxTimeMS' => 0]) |
|
280 | { |
|
281 | $this->validateQueryOptions($options); |
|
282 | ||
283 | $this->logger->info( |
|
284 | 'Mongo find by id', |
|
285 | [ |
|
286 | 'id' => $id, |
|
287 | 'col' => $this->name |
|
288 | ] |
|
289 | ); |
|
290 | ||
291 | return $this->collection->findOne([$this->getIdField() => self::createObjectId($id)], $options); |
|
292 | } |
|
293 | ||
294 | /** |
|
295 | * @param array $documents |