Skip to content

Commit e21950b

Browse files
committed
move section
1 parent 6654a80 commit e21950b

File tree

1 file changed

+35
-39
lines changed

1 file changed

+35
-39
lines changed

docs/query-builder.txt

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,41 @@ wildcard characters:
381381
...
382382
]
383383

384+
whereLike() and whereNotLike() Methods
385+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
386+
387+
You can perform queries to match string patterns by using the
388+
following methods:
389+
390+
- ``whereLike()``: Matches a specified pattern. By default, this method
391+
performs a case-insensitive match. You can enable case-sensitivity by
392+
passing ``true`` as the last parameter to the method.
393+
- ``whereNotLike()``: Matches documents in which the field
394+
value does not contain the specified string pattern.
395+
396+
The following example shows how to use the ``whereLike()`` method to
397+
match documents in which the ``title`` field has a value that matches the
398+
pattern ``'Start%'`` with case-sensitivity enabled:
399+
400+
.. io-code-block::
401+
:copyable: true
402+
403+
.. input:: /includes/query-builder/QueryBuilderTest.php
404+
:language: php
405+
:dedent:
406+
:start-after: begin query whereLike
407+
:end-before: end query whereLike
408+
409+
.. output::
410+
:language: json
411+
:visible: false
412+
413+
[
414+
{ "title": "Start-Up", ... },
415+
{ "title": "Start the Revolution Without Me", ... },
416+
...
417+
]
418+
384419
.. _laravel-query-builder-distinct:
385420

386421
Retrieve Distinct Values
@@ -847,45 +882,6 @@ To learn more about regular expression queries in MongoDB, see
847882
:manual:`$regex </reference/operator/query/regex/>`
848883
in the {+server-docs-name+}.
849884

850-
whereLike() and whereNotLike() Methods
851-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
852-
853-
You can perform queries to match string patterns by using the
854-
following methods:
855-
856-
- ``whereLike()``: Matches a specified pattern. By default, this method
857-
performs a case-insensitive match. You can enable case-sensitivity by
858-
passing ``true`` as the last parameter to the method.
859-
- ``whereNotLike()``: Matches documents in which the field
860-
value does not contain the specified string pattern.
861-
862-
The following example shows how to use the ``whereLike()`` method to
863-
match documents in which the ``title`` field has a value that matches the
864-
pattern ``'Start%'`` with case-sensitivity enabled:
865-
866-
.. literalinclude:: /includes/query-builder/QueryBuilderTest.php
867-
:language: php
868-
:dedent:
869-
:start-after: begin query whereLike
870-
:end-before: end query whereLike
871-
872-
The preceding query matches documents with the following ``title``
873-
field values:
874-
875-
.. code-block:: none
876-
877-
Start-Up
878-
Start the Revolution Without Me
879-
Starting Over
880-
881-
The query doesn't match the following ``title`` values:
882-
883-
.. code-block:: none
884-
885-
Restart
886-
starting over
887-
I Start Counting
888-
889885
.. _laravel-query-builder-whereRaw:
890886

891887
Run MongoDB Query API Operations Example

0 commit comments

Comments
 (0)