Forgive the nooby question, I feel like I'm missing something dumb here but no matter what I try I can't get this Mongoose query to fire inside my io route here.
Any ideas, anyone?
var mongoose = require('mongoose'),
User = mongoose.model('User')
var ObjectId = mongoose.Types.ObjectId
module.exports = function(app) {
app.io.route('user', {
follow: function(req) {
User
.findOne({
_id: ObjectId.fromString(req.session.passport.user)
})
.exec(function (err, user) {
if (err) console.log(err)
if (!user) console.log('Failed to load User id ' + req.session.passport.user)
// DO STUFF
})
},
}
Forgive the nooby question, I feel like I'm missing something dumb here but no matter what I try I can't get this Mongoose query to fire inside my io route here.
Any ideas, anyone?