Switch data storage over to MongoDB.

Review Request #7235 — Created April 21, 2015 and submitted

david
student-sonar
master
72ac013...
student-sonar

As sonar gets more complicated, it's no longer feasible to manually maintain a
big JSON file to store all the data. This change swaps that out in favor of
MongoDB, hosted via a heroku add-on.

The schema itself is currently identical to what I was using in students.json,
so there's very little to change on the front-end. The only difference is that
there's less depth to get to the actual students, since I removed the whole
top-level "term" nonsense.

The nice thing about this is that it will now be very easy to add lots of
functionality that requires the web server to be able to write data (such as
having students submit their status reports directly).

Verified that everything still loaded correctly.

Description From Last Updated

Why mongodbURL instead of mongodbURI ?

brenniebrennie

This doesn't seem to actually use app.

brenniebrennie

This is the exact same code as in bin/load-slack-users. Can we refactor this out into somewhere both modules can use ...

brenniebrennie

Is there ever a case where we will be initializing mongoDB but not the schema (assuming the connection is successful) ...

brenniebrennie
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        lib/config.js
        package.json
        server.js
        bin/load-slack-users
        lib/students.js
        lib/frontend/main.js
        lib/schema.js
        lib/routes.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        lib/config.js
        package.json
        server.js
        bin/load-slack-users
        lib/students.js
        lib/frontend/main.js
        lib/schema.js
        lib/routes.js
    
    
  2. 
      
brennie
  1. 
      
  2. lib/config.js (Diff revision 1)
     
     

    Why mongodbURL instead of mongodbURI ?

    1. No reason. I'll change it.

  3. 
      
david
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        lib/config.js
        package.json
        server.js
        bin/load-slack-users
        lib/students.js
        lib/frontend/main.js
        lib/schema.js
        lib/routes.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        lib/config.js
        package.json
        server.js
        bin/load-slack-users
        lib/students.js
        lib/frontend/main.js
        lib/schema.js
        lib/routes.js
    
    
  2. 
      
brennie
  1. A few refactory nits, but it looks good to me!

  2. lib/routes.js (Diff revision 2)
     
     

    This doesn't seem to actually use app.

  3. server.js (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    This is the exact same code as in bin/load-slack-users. Can we refactor this out into somewhere both modules can use it?

  4. server.js (Diff revision 2)
     
     
     
     
     

    Is there ever a case where we will be initializing mongoDB but not the schema (assuming the connection is successful) ?

    If not, why don't we include this in the promise resolving function in initMongodb ?

  5. 
      
david
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (7963c22)
Loading...