Skip to content

Database Structure

Tonnieboy300 edited this page Jun 4, 2026 · 5 revisions

MongoDB databases are sets of "collections" of "documents". Each JSON-like document represents one object, like a match or account. Listed are the collections NerdScout creates in the NerdScout database.

accounts

Stores all user accounts.

  • username: The account's username
  • passwordHash: The account's hashed password
  • approved: If the account is approved and can log in
  • admin: If the account is an admin and can access admin-only pages
  • points: The NerdPredict points held by the account
  • pickems: The user's NerdPredict pickems
    • m[number] and finals: Stores three fields: red and blue, ints representing which alliances the user predicted would b in the match, and winner, the alliance the user predicted would win, either red or blue.
    • winner: The predicted winning alliance number.
    • points: How many points the user spent on the prediction
    • paid: If the prediction was paid out
  • predictions: The user's NerdPredict predictions on matches.
    • This field is an object of objects, with each object's key being a match key.
      • forRed: If the prediction is for the red alliance winning
      • points: The points spent on the prediction
      • matchComplete: If the match has been scored by FMS and paid out
      • correct: If the prediction was correct
      • timestamp: A date object for when the prediction was created
  • dbAdmin (optional): If the account can access dbAdmin functions, like NerdPredict payouts.

matches

Stores each match.

  • matchNumber: The match's number within its CompLevel
  • setNumber: The match's set number, usually 1, but is used for playoffs, not including finals.
  • compLevel: The match's competition level. Values come from an Enum in constants.py
  • matchKey: The match's identifier with The Blue Alliance
  • displayName: A formatted name for frontend display
  • predictionData: Raw prediction data from Statbotics, game specific.
  • prizePool: Stores three ints, overall, red, and blue, showing how many points have been spent on each alliance in NerdPredict.
  • teams: The match's teams by station, in format [color][number]. For example, red1 or blue3.
  • results: The match's scouting data and official results.
    • scored: If the match has been scored by FMS
    • actualTime: If scored, the time the match started, reported by FMS in seconds since the UNIX epoch
    • postResultTime: The time the match's score was posted by FMS, in seconds since the UNIX epoch
    • winningAlliance: The alliance that won, according to FMS. Either "red" or "blue", or blank in the case of a tie
    • scoreBreakdown: Two objects, red and blue, with game specific scoring data from FMS.
    • Stations: Each station is listed with match results in an array, with index 0 being oldest.
      • This is game specific; check games.py for more info.

teams

Stores each team.

  • number: The team's number
  • longName: The team's full name, usually with sponsors
  • shortName: The team's nickname, usually what they are best known as
  • comment: Unused, previously used for comments before pit scouting was implemented
  • images: Array of objects, each object representing one image
    • location: The location of the image, within /static
    • scout: The user who submitted the image

requests

Stores "requests", currently only password changes.

  • type: The type of request, should be "passwordChange"
  • data: The request's data
    • passwordChange data
      • username: The username of the user who requested the password change
      • passwordHash: The requested password hash
      • timestamp: The time the request was made

Clone this wiki locally