Explore Developer Center's New Chatbot! MongoDB AI Chatbot can be accessed at the top of your navigation to answer all your MongoDB questions.

MongoDB Developer
Atlas
plus
Sign in to follow topics
MongoDB Developer Centerchevron-right
Developer Topicschevron-right
Productschevron-right
Atlaschevron-right

Atlas Search from Soup to Nuts: The Restaurant Finder Demo App

Karen Huaulme3 min read • Published Feb 01, 2022 • Updated May 09, 2022
Atlas
Facebook Icontwitter iconlinkedin icon
Rate this article
star-empty
star-empty
star-empty
star-empty
star-empty
Hey! Have you heard about the trendy, new restaurant in Manhattan named Karma? No need to order off the menu. You just get what you deserve. 😋 🤣 And with MongoDB Atlas Search, you also get exactly what you deserve by using a modern application development platform. You get the lightning-fast, relevance-based search capabilities that come with Apache Lucene on top of the developer productivity, resilience, and scale of MongoDB Atlas. Apache Lucene is the world’s most popular search engine library. Now together with Atlas, making sophisticated, fine-grained search queries is a piece of cake.
In this video tutorial, I am going to show you how to build out Atlas Search queries quickly with our Atlas Search Restaurant Finder demo application, which you will find at www.atlassearchrestaurants.com. This app search demo is based on a partially mocked dataset of over 25,000 restaurants in the New York City area. In it, you can search for restaurants based on a wide variety of search criteria, such as name, menu items, location, and cuisine.
This sample search app serves up all the Atlas Search features and also gives away the recipe by providing live code examples. As you interact with the What’s Cooking Restaurant Finder, see how your search parameters are blended together with varying operators within the $search stage of a MongoDB aggregation pipeline. Like combining the freshest ingredients for your favorite dish, Atlas Search lets you easily mix simple searches together using the compound operator.
I named this application “What’s Cooking,” but I should have called it “The Kitchen Sink” because it offers a smorgasbord of so many popular Atlas Search features:
  • Fuzzy Search - to tolerate typos and misspellings. Desert, anyone?
  • Autocomplete - to search-as-you-type
  • Highlighting - to extract document snippets that display search terms in their original context
  • Geospatial search - to search within a location’s radius or shape
  • Synonyms - Wanna Coke or a Pop? Search for either one with defined synonyms
  • Custom Scoring - that extra added flavor to modify search results rankings or to boost promoted content
  • Facets and Counts - slice and dice your returned data into different categories
Looking for some killer New York pizza within a few blocks of MongoDB’s New York office in Midtown? How about some savory search synonyms! Any special restaurants with promotions? We have search capabilities for every appetite. And to kick it up a notch, we let you sample the speed of fast, native Lucene facets and counts - currently in public preview.
Feast your eyes!
Atlas Search queries are built using $search in a MongoDB aggregation pipeline
Notice that even though searches are based in Lucene, Atlas Search queries look like any other aggregation stage, easily integrated into whatever programming language without any extra transformation code. No more half-baked context switching as needed with any other stand-alone search engine. This boils down to an instant productivity boost!
What is in our secret sauce, you ask? We have embedded an Apache Lucene search engine alongside your Atlas database. This synchronizes your data between the database and search index automatically. This also takes off your plate the operational burden and additional cost of setting-up, maintaining, and scaling a separate search platform. Now not only is your data architecture simplified, but also your developer workload, as now developers can work with a single API. Simply stated, you can now have champagne taste on a beer budget. 🥂🍾
If this application has whet your appetite for development, the code for the What’s Cooking Restaurant Finder application can be found here: (​​https://github.com/mongodb-developer/whatscooking) This repo has everything from soup to nuts to recreate the What’s Cooking Restaurant Finder:
  • React and Tailwind CSS on the front-end
  • The code for the backend APIs
  • The whatscooking.restaurants dataset mongodb+srv://mongodb@shareddemoapps.dezdl.mongodb.net/whatscooking
This recipe - like all recipes - is merely a starting point. Like any chef, experiment. Use different operators in different combinations to see how they affect your scores and search results. Try different things to suit your tastes. We’ll even let you eat for free - forever! Most of these Atlas Search capabilities are available on free clusters in Atlas.
Bon appetit and happy coding!

Facebook Icontwitter iconlinkedin icon
Rate this article
star-empty
star-empty
star-empty
star-empty
star-empty
Related
Tutorial

Improve Your App's Search Results with Auto-Tuning


Aug 14, 2024 | 5 min read
Tutorial

Serverless Development with Kotlin, AWS Lambda, and MongoDB Atlas


Aug 01, 2023 | 6 min read
Tutorial

Using the Node.js MongoDB Driver with AWS Lambda


Jan 23, 2024 | 5 min read
Tutorial

Build a CRUD API With MongoDB, Typescript, Express, Prisma, and Zod


Sep 04, 2024 | 10 min read