Skip to content

mongodb-developer/atlas-search-soccer

Repository files navigation

Atlas Search Soccer

Build your Soccer Dream Team with MongoDB Atlas Search

Every four years, for the sake of blending in, I pretend to know soccer. When the World Cup is on, I’m overwhelmed by the exuberant fans with colorful soccer jerseys. Jerseys with unfamiliar names from far away places. I recognize Messi and Ronaldo, but the others …? Mkhitaryan, Szczęsny, Großkreutz? How can I look up their stats to feign familiarity when I have no idea how to spell their names?

Well, now there's this app for that. Atlas Search Soccer is an interactive Atlas Search tutorial and instant sports bar credibility builder.

Teaming up MongoDB Atlas Search with an extensive player dataset, you can scout across the over 22,000 players in the database based on a variety of search parameters and data types:

  • player name
  • player position
  • nationality
  • club
  • skill level
  • age
  • salary

Equipped with only a search box, sliders and checkboxes, find the world's best players with the most impossible-to-spell names to build out your own Soccer Dream Team. Autocomplete, wildcard, and filters to find Ibrahimović, Błaszczykowski, and Szczęsny? No problem!

As you interact with the application, you'll see the $search operator in a MongoDB aggregation pipeline live in-action!

When you pick a footballer for your team, he is written to local storage on your device. That way, your Dream Team stays warmed up and on the pitch even after you close your browser.

Skills and Drills

  • search operators:
    • text
    • wildcard
    • autocomplete
    • range
  • fuzzy matching
  • indexes and analyzers
  • compound operator
  • relevance based scoring
  • custom score modifiers
  • filters, facets and counts

So give it a shot, and you'll be an Atlas Search pro in no time!

Game Notes 📝

This application hosted entirely by MongoDB Atlas was created using:

Currently this app is not suitable for mobile, but feel free to send a PR. 😊


Want to play in your own stadium? Here's how to build Atlas Search Soccer on your own free cluster.

Atlas Search Soccer runs on a very streamlined game plan where MongoDB Atlas is the MVP. No additional servers or software needed. No need to keep data in sync. Everything is done in MongoDB Atlas.

Prerequisites

  • A MongoDB Atlas account. Get one for free here.
  • A recent version of Node.js and npm.
  • Extensive worldwide player dataset (players22.json) provided in the data folder.
  • (Recommended) MongoDB Compass - GUI

It is also included in this repo's data folder as

players22.json


To Run This Application....
  1. Clone the repo.
  2. Navigate inside atlas-search-soccer directory.
  3. Run npm install .
  4. Run npm start .

Prepare Data

Load data to Atlas cluster:

  • database: soccer
  • collection: players22

React Components....

Using Atlas App Services as Your Serverless Backend....

AtlasSearchSoccer uses HTTP services in App Services to create 5 APIs to allow you to query for your player data over HTTP:

The data is queried from useHomeFetch.js in the hooks directory. Here you'll find the endpoints for the backend search queries using the $search operator:

  • BasicSearchEndPoint
  • WildcardEndPoint
  • AutocompleteEndpoint
  • AdvancedSearchEndPoint
  • FacetsEndPoint Find the code for these webhooks in the AppServices folder.


If you have any questions or feedback about this repo, feel free to create an Issue or PR in this repo or reach out to me on Twitter @YouOldMaid.

Also please join our online MongoDB Community to interact with our product and engineering teams along with thousands of other MongoDB and Realm users.

Have fun and happy coding!

Disclaimer

Use at your own risk; not a supported MongoDB product

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published