@@ -353,23 +353,38 @@ query builder method to retrieve documents from the
353
353
Match Dates Example
354
354
^^^^^^^^^^^^^^^^^^^
355
355
356
- The following example shows how to use the ``whereDate ()``
356
+ The following example shows how to use the ``where ()``
357
357
query builder method to retrieve documents from the
358
- ``movies`` collection that match the specified date of
359
- ``2010-1-15`` in the ``released `` field :
358
+ ``movies`` collection in which the ``released`` value
359
+ is January 15, 2010, specified in a ``Carbon `` object :
360
360
361
361
.. literalinclude:: /includes/query-builder/QueryBuilderTest.php
362
362
:language: php
363
363
:dedent:
364
- :start-after: begin query whereDate
365
- :end-before: end query whereDate
364
+ :start-after: begin query where date
365
+ :end-before: end query where date
366
366
367
- .. note:: Date Query Result Type
367
+ .. note:: Date Query Filter and Result Type
368
368
369
- Starting in {+odm-long+} v5.0, ``UTCDateTime`` BSON values in MongoDB
370
- are returned as `Carbon <https://carbon.nesbot.com/docs/>`__ date
371
- classes in query results. The {+odm-short+} applies the default
372
- timezone when performing this conversion.
369
+ Starting in {+odm-long+} v5.0, `Carbon <https://carbon.nesbot.com/docs/>`__
370
+ objects passed as query filters, as shown in the preceding code, are
371
+ converted to ``UTCDateTime`` BSON values.
372
+
373
+ In query results, ``UTCDateTime`` BSON values in MongoDB are returned as ``Carbon``
374
+ objects. The {+odm-short+} applies the default timezone when performing
375
+ this conversion.
376
+
377
+ If you want to represent a date as a string in your query filter
378
+ rather than as a ``Carbon`` object, use the ``whereDate()`` query
379
+ builder method. The following example retrieves documents from
380
+ the ``movies`` collection in which the ``released`` value
381
+ is January 15, 2010 and specifies the date as a string:
382
+
383
+ .. literalinclude:: /includes/query-builder/QueryBuilderTest.php
384
+ :language: php
385
+ :dedent:
386
+ :start-after: begin query whereDate string
387
+ :end-before: end query whereDate string
373
388
374
389
.. _laravel-query-builder-pattern:
375
390
0 commit comments