We will show how to build different kinds of search experiences with Atlas Search using the ReactiveSearch API.
The ReactiveSearch Realm function endpoint exposes a REST API that all of ReactiveSearch and Searchbox UI libraries use to express the declarative search intent. The ReactiveSearch API is documented over here.
For this guide, we are making use of a publicly deployed Realm endpoint. You can substitute this with your deployed function's URL.
url=https://us-east-1.aws.webhooks.mongodb-realm.com/api/client/v2.0/app/public-demo-skxjb/service/http_endpoint/incoming_webhook/reactivesearch
Note: Some of the examples make use of specific data types such as geopoint or autocomplete. These are already preset in the indexes they're queried against in these examples, but if you're replacing the Realm function endpoint, these data types need to be set prior to running the queries.
Use Cases
Facet (list) examples
A single/multi select facet UI is typically represented with a term query. Here, we will take a look at different ways of creating this UI.
Getting the top buckets
Sort buckets by asc
order
Finding any of the facet items: A multi-select filtering use-case
Finding all of the facet items: A multi-select filtering use-case
Passing MongoDB aggregation stages directly to override the default query of the term component
Passing MongoDB aggregation stages directly to override the default query of the result component
Range examples
A Range UI is typically represented as a range selector, range input/slider, or a date picker.
Get the results within the given range of a field value
Get results within a given range as well as return min, max and histogram aggregations
Return documents with null values in the path (aka field) for a given range selection
Geo (map) examples
A map (Google Maps, OpenStreetMaps) is typically used for building geo UIs. It primarily uses two types of queries.
Searching within a circle
Searching within a bounding box
Search (typeahead) examples
A searchbox is typically used for building an autosuggestions or a highlighting based experience.