Skip to content

JinLeeGG/MongoDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Food Review App

A command-line food review application built with Python and MongoDB that allows users to register, add foods, rate them, and view reviews.

Features

  • User Registration: Register with a username to start using the app
  • Food Management: Add and delete food items with category and region information
  • Rating System: Rate foods on a scale of 0-10 with written reviews
  • Review Management: View and edit your own reviews
  • Food Discovery: Browse all registered foods and their reviews
  • Top Rankings: View the top 3 highest-rated foods based on average scores

Prerequisites

  • Python 3.x
  • MongoDB database
  • Required Python packages:
    • pymongo
    • bson

Installation

  1. Install the required packages:
pip install pymongo
  1. Set up MongoDB connection:

    • Update the url variable in the code with your MongoDB connection string
    • Example: url = 'mongodb://localhost:27017/'
  2. Run the application:

python food_review_app.py

Database Structure

The application uses three MongoDB collections:

Collections

  • users: Stores user information

    • _id: ObjectId (auto-generated)
    • username: String
  • foods: Stores food information

    • _id: ObjectId (auto-generated)
    • name: String
    • category: String (e.g., Chinese, Korean, Street food)
    • region: String (delivery area)
  • ratings: Stores user ratings and reviews

    • _id: ObjectId (auto-generated)
    • user_id: ObjectId (reference to users collection)
    • food_id: ObjectId (reference to foods collection)
    • score: Float (0-10 scale)
    • comment: String (review text)

Usage

Upon running the application, you'll be prompted to:

  1. Register with a username
  2. Choose from the menu options:
    • View all registered foods
    • Add new foods to the database
    • Delete existing foods
    • Rate and review foods
    • Edit your existing reviews
    • View reviews for specific foods
    • See the top 3 highest-rated foods

Menu Options

  1. 음식 목록 보기 (View Food List) - Display all registered foods
  2. 음식 등록하기 (Register Food) - Add a new food item
  3. 음식 삭제하기 (Delete Food) - Remove a food item
  4. 음식 별점 남기기 (Rate Food) - Add a rating and review
  5. 내 리뷰 수정하기 (Edit My Review) - Modify your existing reviews
  6. 음식 리뷰 보기 (View Food Reviews) - See all reviews for a specific food
  7. 별점 높은 음식 TOP 3 보기 (View Top 3 Foods) - Display highest-rated foods
  8. 종료하기 (Exit) - Close the application

Key Functions

  • register_user(): User registration system
  • show_foods(): Display all foods with their details
  • add_food(): Add new food items
  • delete_food(): Remove food items from database
  • rate_food(): Submit ratings and reviews
  • update_rating(): Edit existing reviews
  • show_food_reviews(): Display reviews for specific foods
  • show_best_foods(): Show top-rated foods using MongoDB aggregation

Technical Features

  • Uses MongoDB aggregation pipeline for calculating average ratings
  • ObjectId handling for proper database relationships
  • Input validation and user-friendly error messages
  • Korean language interface

Configuration

Before running the application, make sure to:

  1. Set up your MongoDB connection string in the url variable
  2. Ensure MongoDB is running and accessible
  3. Install all required dependencies

License

This project is open source and available under the MIT License.

About

MongoDB demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages