@@ -25,12 +25,20 @@ In this guide, you can learn how to use the **Atlas Search** feature on a collec
2525Atlas Search enables you to perform full-text searches on collections hosted on MongoDB
2626Atlas. Atlas Search indexes specify the behavior of the search and which fields to index.
2727
28+ Sample Data
29+ ~~~~~~~~~~~
30+
31+ The example in this guide uses the ``movies`` collection in the ``sample_mflix``
32+ database from the :atlas:`Atlas sample datasets </sample-data>`. To learn how to
33+ create a free MongoDB Atlas cluster and load the sample datasets, see the
34+ :atlas:`Get Started with Atlas </getting-started>` guide.
35+
2836Run an Atlas Search Query
2937-------------------------
3038
3139This section shows how to create an aggregation pipeline to run an
32- Atlas Search on a collection. You can use ``Aggregates.search`` builder to
33- create a ``$search`` pipeline stage and specify your search. Then, call
40+ Atlas Search on a collection. You can use the ``Aggregates.search() `` builder
41+ method to create a ``$search`` pipeline stage and specify your search. Then, call
3442the ``aggregate()`` method and pass your pipeline as a parameter.
3543
3644.. tip::
@@ -42,23 +50,16 @@ Before running an Atlas Search query, you must create an Atlas Search index
4250on your collection. To learn how to programmatically create an Atlas Search
4351index, see the :ref:`java-search-indexes` section in the Indexes guide.
4452
45- Sample Data
46- ~~~~~~~~~~~
47-
48- The example in this section uses the ``movies`` collection in the ``sample_mflix``
49- database from the :atlas:`Atlas sample datasets </sample-data>`. To learn how to
50- create a free MongoDB Atlas cluster and load the sample datasets, see the
51- :atlas:`Get Started with Atlas </getting-started>` guide.
52-
5353Atlas Search Example
5454~~~~~~~~~~~~~~~~~~~~
5555
5656This example performs an Atlas Search query by calling the
57- ``aggregate()`` method and passing the following pipeline stages:
57+ ``aggregate()`` method and passing the following pipeline stage
58+ builders:
5859
59- - ``Aggregates.search``: Specifies a search query for documents in which
60+ - ``Aggregates.search() ``: Specifies a search query for documents in which
6061 the ``title`` field contains the word ``"Alabama"``
61- - ``Aggregates.project``: Projects the ``title`` field of each matching document
62+ - ``Aggregates.project() ``: Projects the ``title`` field of each matching document
6263
6364.. io-code-block::
6465 :copyable:
@@ -92,9 +93,9 @@ in the Atlas documentation.
9293API Documentation
9394~~~~~~~~~~~~~~~~~
9495
95- To learn more about the methods and pipeline stages mentioned in this guide, see
96+ To learn more about the methods mentioned in this guide, see
9697the following API documentation:
9798
9899- `MongoCollection.aggregate() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#aggregate(java.util.List)>`__
99- - `Aggregates.search <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#search(com.mongodb.client.model.search.SearchCollector)>`__
100- - `Aggregates.project <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#project(org.bson.conversions.Bson)>`__
100+ - `Aggregates.search() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#search(com.mongodb.client.model.search.SearchCollector)>`__
101+ - `Aggregates.project() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#project(org.bson.conversions.Bson)>`__
0 commit comments