Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions homework3/feedback.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Homework Feedback for Cat App with Mongoose:

Functionality:

All of the required features work!
The createToy function does not work because toys is a property of each cat within allCats,
not a property of allCats. If you want to try out embedding again, you will probably know how to do this now! Nice job trying out an additional/challenging feature. Your advanced query was functional.

The only bugs were in the additional challenges portion of the assignment, so you will not lose any points for those.

Completion: (20/20)
Bug Free: (10/10)

Quality:

You followed good coding practices throughout! Your code was very readable.
It looks like you forgot to put a comment explaining what the gteCat function does, and spacing could be a little more consistent.

Good Coding Practices: (10/10)
Readability: (9/10)


Summary:
Nice work! Your advanced query worked and it was awesome to start trying out something more challenging. You had a great handle on how to integrate the mongo database!

(49/50)
2 changes: 1 addition & 1 deletion homework3/models/catModel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// getting-started.js
// getting-started.js <- Is this leftover from a boiler plate?
var mongoose = require('mongoose');
var Toy = require('../models/toyModel.js');
mongoose.connect('mongodb://localhost/cats');
Expand Down
8 changes: 8 additions & 0 deletions homework3/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ function randColors(array){
var createToy = function (req,res){
Cat.find({}, function(err,allCats){
var myToy = new Toy({name:rand(catToys)});

// The reason that this does not work is that toys is a property of each cat in allCats
// not a property of allCats. If you print allCats you can see that it's a list of cats.
// Because of this allCats.toys does not exist and going to the /newtoy route makes the app crash.
// Awesome to work towards implementing this additional feature though.
allCats.toys.push(myToy);
allCats.save();
console.log(allCats)
Expand Down Expand Up @@ -97,6 +102,9 @@ var deleteCat = function (req,res){
});
}


// Would be nice to add a comment here explaining what this function is for!
// It is functional though! Nice use of an advanced query here.
var gteCat = function (req,res){
Cat.find({age: {$gte: 7}}, function(err, allCats){
res.render("cats",{"classes": allCats})
Expand Down