Reputation: 177
i have some problems changing my list function in the server controller of my MEANJS app. This is the export.list function in the server controller of my module:
exports.list = function(req, res) {
Wordset.find({ 'user':req.user._id }).sort('-created').populate('user', 'displayName').exec(function(err, wordsets) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(wordsets);
}
});
};
What it does is that it lists all the items from this module in the listview. In this case it shows all Wordset fromt this user. What i would like to change is that it should show Wordsets not depending on the user, but depending on another module (a user can create persons and each person should have his own wordsets). Lets say i have stored the person._id already, what changes do i need to do here to show only the Worsets for this specific person?
Upvotes: 0
Views: 35
Reputation: 1844
May be something like this (ofc. if Wordset has person field):
Wordset.find({ 'person': person._id })
Upvotes: 0