@@ -37,7 +37,7 @@ To learn more about the ``$search`` pipeline stage, see :manual:`$search
3737The examples in this guide use the following documents in a collection called
3838``guitars``:
3939
40- .. code-block:: json
40+ .. code-block:: text
4141
4242 { "_id": 1, "make": "Fender", "description": "Classic guitars known for their versatility.", "establishedYear": 1946, "in_stock": true, "rating": 9 }
4343 { "_id": 2, "make": "Gibson", "description": "Classic guitars known for their rich, full tones.", "establishedYear": 1902, "in_stock": true, "rating": 8 }
@@ -108,7 +108,7 @@ collection using the string "Gib" in the ``make`` field.
108108
109109The search returns the following document:
110110
111- .. code-block:: json
111+ .. code-block:: text
112112
113113 { "_id" : 2, "make" : "Gibson", "description" : "Classic guitars known for their rich, full tones.", "establishedYear" : 1902, "in_stock" : true, "rating" : 8 }
114114
@@ -136,7 +136,7 @@ that match all of the following criteria:
136136
137137The search returns the following documents:
138138
139- .. code-block:: json
139+ .. code-block:: text
140140
141141 { "_id" : 1, "make" : "Fender", "description" : "...", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
142142 { "_id" : 3, "make" : "PRS", "description" : "...", "establishedYear" : 1985, "in_stock" : true, "rating" : 9 }
@@ -186,7 +186,7 @@ and returns any documents with a ``serial`` field value of ``"YZ5678"``:
186186
187187The search returns the following document:
188188
189- .. code-block:: json
189+ .. code-block:: text
190190
191191 { "_id" : 1, "make" : "Fender", "description" : "Classic guitars known for their versatility.", "establishedYear" : 1946, "in_stock" : true, "rating" : 9, "productDetails" : [{ "product_id" : 1234, "serial" : "YZ5678" }] }
192192
@@ -210,7 +210,7 @@ which the value of the ``in_stock`` field is ``true``.
210210
211211The search returns the following documents:
212212
213- .. code-block:: json
213+ .. code-block:: text
214214
215215 { "_id" : 1, "make" : "Fender", "description" : "...", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
216216 { "_id" : 2, "make" : "Gibson", "description" : "...", "establishedYear" : 1902, "in_stock" : true, "rating" : 8 }
@@ -239,7 +239,7 @@ which the ``rating`` field exists.
239239
240240The search returns the following documents:
241241
242- .. code-block:: json
242+ .. code-block:: text
243243
244244 { "_id" : 1, "make" : "Fender", "description" : "...", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
245245 { "_id" : 2, "make" : "Gibson", "description" : "...", "establishedYear" : 1902, "in_stock" : true, "rating" : 8 }
@@ -282,7 +282,7 @@ polygon:
282282
283283The search returns the following document:
284284
285- .. code-block:: json
285+ .. code-block:: text
286286
287287 { "_id" : 1, "make" : "Fender", "description" : "...", "establishedYear" : 1946, "in_stock" : true, "in_stock_location" : { "type" : "Point", "coordinates" : ["-73.93615", "40.69791"] }, "rating" : 9 }
288288
@@ -328,7 +328,7 @@ polygon:
328328
329329The search returns the following document:
330330
331- .. code-block:: json
331+ .. code-block:: text
332332
333333 { "_id" : 1, "make" : "Fender", "description" : "Classic guitars known for their versatility.", "establishedYear" : 1946, "in_stock" : true, "in_stock_location" : { "type" : "Point", "coordinates" : ["-73.93615", "40.69791"] }, "rating" : 9 }
334334
@@ -352,7 +352,7 @@ The following example searches the ``guitars`` collection for documents that hav
352352
353353The search returns the following documents:
354354
355- .. code-block:: json
355+ .. code-block:: text
356356
357357 { "_id": 1, "make": "Fender", "description": "...", "establishedYear": 1946, "in_stock": true, "rating": 9 }
358358 { "_id": 2, "make": "Gibson", "description": "...", "establishedYear": 1902, "in_stock": true, "rating": 8 }
@@ -375,7 +375,7 @@ quality."
375375
376376The search returns the following documents:
377377
378- .. code-block:: json
378+ .. code-block:: text
379379
380380 { "_id" : 3, "make" : "PRS", "description" : "High-end guitars known for their quality.", "establishedYear" : 1985, "in_stock" : true, "rating" : 9 }
381381 { "_id" : 4, "make" : "Kiesel", "description" : "Quality guitars made only for custom orders.", "establishedYear" : 2015, "in_stock" : false, "rating" : null }
@@ -406,7 +406,7 @@ order based on how close the value is to the number ``9``.
406406
407407The search returns the following documents:
408408
409- .. code-block:: json
409+ .. code-block:: text
410410
411411 { "_id" : 1, "make" : "Fender", "description" : "...", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
412412 { "_id" : 3, "make" : "PRS", "description" : "...", "establishedYear" : 1985, "in_stock" : true, "rating" : 9 }
@@ -434,7 +434,7 @@ the ``description`` field contains the phrase "classic guitars."
434434
435435The search returns the following documents:
436436
437- .. code-block:: json
437+ .. code-block:: text
438438
439439 { "_id" : 1, "make" : "Fender", "description" : "Classic guitars known for their versatility.", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
440440 { "_id" : 2, "make" : "Gibson", "description" : "Classic guitars known for their rich, full tones.", "establishedYear" : 1902, "in_stock" : true, "rating" : 8 }
@@ -450,7 +450,7 @@ phrases as follows:
450450
451451This search returns the following documents:
452452
453- .. code-block:: json
453+ .. code-block:: text
454454
455455 { "_id" : 1, "make" : "Fender", "description" : "Classic guitars known for their versatility.", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
456456 { "_id" : 4, "make" : "Kiesel", "description" : "Quality guitars made only for custom orders.", "establishedYear" : 2015, "in_stock" : false, "rating" : null }
@@ -484,7 +484,7 @@ the value of the ``description`` field matches each of the following criteria:
484484
485485The search returns the following documents:
486486
487- .. code-block:: json
487+ .. code-block:: text
488488
489489 { "_id" : 1, "make" : "Fender", "description" : "Classic guitars known for their versatility.", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
490490 { "_id" : 3, "make" : "PRS", "description" : "High-end guitars known for their quality.", "establishedYear" : 1985, "in_stock" : true, "rating" : 9 }
@@ -497,7 +497,7 @@ Range
497497~~~~~
498498
499499Use the ``Range()`` method to search for documents in which the value of a
500- specified field falls within a given numeric or date range.
500+ specified field falls within a given numeric, date, or string range.
501501
502502The following example searches the ``guitars`` collection for all documents with
503503an ``establishedYear`` value greater than 1980 and less than 2020.
@@ -510,12 +510,38 @@ an ``establishedYear`` value greater than 1980 and less than 2020.
510510
511511The search returns the following results:
512512
513- .. code-block:: json
513+ .. code-block:: text
514514
515515 { "_id" : 3, "make" : "PRS", "description" : "High-end guitars known for their quality.", "establishedYear" : 1985, "in_stock" : true, "rating" : 9 }
516516 { "_id" : 4, "make" : "Kiesel", "description" : "Quality guitars made only for custom orders.", "establishedYear" : 2015, "in_stock" : false, "rating" : null }
517517 { "_id" : 6, "make" : "Strandberg", "description" : "Modern guitars known for their headless models.", "establishedYear" : 1982, "in_stock" : false, "rating" : null }
518518
519+ To search for documents in which the value of a specified field is within a
520+ range of strings, you must first create a :atlas:`token index
521+ </atlas-search/field-types/token-type/>` on the field. After you create the
522+ index, you can search for documents based on a range of strings as shown in the
523+ following example:
524+
525+ .. literalinclude:: /includes/fundamentals/code-examples/atlas-search/AtlasSearchExamples.cs
526+ :start-after: // start-range-string
527+ :end-before: // end-range-string
528+ :language: csharp
529+ :dedent:
530+
531+ The preceding example searches for any documents in which the string value of the
532+ ``make`` field is greater than or equal to ``"Fender"`` and less than or equal
533+ to ``"Kiesel"``. The driver compares the string values in :wikipedia:`lexicographic order
534+ <Lexicographic_order>`.
535+
536+ The search returns the following results:
537+
538+ .. code-block:: text
539+
540+ { "_id" : 1, "make" : "Fender", "description" : "Classic guitars known for their versatility.", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
541+ { "_id" : 2, "make" : "Gibson", "description" : "Classic guitars known for their rich, full tones.", "establishedYear" : 1902, "in_stock" : true, "rating" : 8 }
542+ { "_id" : 4, "make" : "Kiesel", "description" : "Quality guitars made only for custom orders.", "establishedYear" : 2015, "in_stock" : false, "rating" : null }
543+ { "_id" : 5, "make" : "Ibanez", "description" : "Well-crafted guitars used by many professional guitarists.", "establishedYear" : 1957, "in_stock" : true, "rating" : 7 }
544+
519545To learn more about the ``range`` operator, see the :atlas:`range </atlas-search/range>`
520546Atlas guide.
521547
@@ -535,7 +561,7 @@ the value of the ``make`` field contains exactly six letters.
535561
536562The search returns the following results:
537563
538- .. code-block:: json
564+ .. code-block:: text
539565
540566 { "_id" : 1, "make" : "Fender", "description" : "Classic guitars known for their versatility.", "establishedYear" : 1946, "in_stock" : true, "rating" : 9 }
541567 { "_id" : 2, "make" : "Gibson", "description" : "Classic guitars known for their rich, full tones.", "establishedYear" : 1902, "in_stock" : true, "rating" : 8 }
@@ -585,7 +611,7 @@ the value of the ``description`` field contains the strings "guitars" and
585611
586612The search returns the following document:
587613
588- .. code-block:: json
614+ .. code-block:: text
589615
590616 { "_id" : 4, "make" : "Kiesel", "description" : "Quality guitars made only for custom orders.", "establishedYear" : 2015, "in_stock" : false, "rating" : null }
591617
@@ -615,7 +641,7 @@ professionals".
615641
616642The search returns the following document:
617643
618- .. code-block:: json
644+ .. code-block:: text
619645
620646 { "_id" : 5, "make" : "Ibanez", "description" : "Well-crafted guitars used by many professional guitarists.", "establishedYear" : 1957, "in_stock" : true, "rating" : 7 }
621647
@@ -661,7 +687,7 @@ field contains the string "Strand" followed by any other characters.
661687
662688The search returns the following document:
663689
664- .. code-block:: json
690+ .. code-block:: text
665691
666692 { "_id" : 6, "make" : "Strandberg", "description" : "Modern guitars known for their headless models.", "establishedYear" : 1982, "in_stock" : false, "rating" : null }
667693
0 commit comments