Skip to content

Commit

Permalink
Merge pull request #28 from postmanlabs/feature/selective_populate_one
Browse files Browse the repository at this point in the history
Fix for issue with one-to-many joins having select criteria.
  • Loading branch information
shamasis committed Jan 2, 2016
2 parents 062c85f + 9091d5d commit 642029d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"lodash": "3.5.0",
"mysql": "2.6.2",
"sails-mysql": "git+https://github.com/postmanlabs/sails-mysql.git#v0.10.12-postman.3"
"sails-mysql": "git+https://github.com/postmanlabs/sails-mysql.git#v0.10.12-postman.5"
},
"devDependencies": {
"expect.js": "^0.3.1",
Expand Down
15 changes: 14 additions & 1 deletion tests/integration/app/api/controllers/CollectionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
*/

module.exports = {

retrieve: function (req, res) {
Collection.findOne({
select: ['name'],
where: {id: req.param('id')}
})
.populate('user', {select: ['name']})
.populate('requests', {select: ['name', 'collection', 'id']})
.exec(function (err, collection) {
if (err) {
return res.serverError(err);
}
res.json(collection);
});
},
};

2 changes: 1 addition & 1 deletion waterline

0 comments on commit 642029d

Please sign in to comment.