Skip to content

Commit

Permalink
Main query no longer includes stuff from the past
Browse files Browse the repository at this point in the history
  • Loading branch information
SSBinks committed Jan 25, 2017
1 parent ae24a51 commit 49afd21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var mongoose = require('mongoose');
var Assignment = require('./models/assignment');
var AssignmentType = require('./models/assignmenttype');
var dotenv = require('dotenv').config();
var port = process.env.PORT || 8081;
var port = process.env.PORT || 8000;
mongoose.connect(process.env.MONGODB_LINK);

app.use(bodyParser.urlencoded({ extended: true}));
Expand All @@ -23,7 +23,9 @@ router.use(function(req, res, next) {
//This works
router.route('/')
.get(function(req, res) {
Assignment.find({}).sort({dueDate: 'ascending'}).exec(function (err, assignment){
const today = moment().format();
console.log('Today is ' + today);
Assignment.find({dueDate: {$gt: today}}).sort({dueDate: 'ascending'}).exec(function (err, assignment){
if(err)
res.send(err);
res.json(assignment);
Expand Down

0 comments on commit 49afd21

Please sign in to comment.