From 7cfd7099b6fcfdc0291d2445ba008d6dfe28dc4e Mon Sep 17 00:00:00 2001 From: Roman Golovin Date: Mon, 9 Nov 2015 15:39:34 +0200 Subject: [PATCH] Add adtional check to filter out null values --- packages/custom/icapi/server/controllers/project.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/custom/icapi/server/controllers/project.js b/packages/custom/icapi/server/controllers/project.js index 4e096ec..af78018 100644 --- a/packages/custom/icapi/server/controllers/project.js +++ b/packages/custom/icapi/server/controllers/project.js @@ -14,8 +14,7 @@ exports.defaultOptions = options; var crud = require('../controllers/crud.js'); var projectController = crud('projects', options); -var utils = require('./utils'), - mongoose = require('mongoose'), +var mongoose = require('mongoose'), Project = mongoose.model('Project'), Task = mongoose.model('Task'), User = mongoose.model('User'), @@ -120,7 +119,7 @@ exports.getByDiscussion = function (req, res, next) { var entityQuery = { discussions: req.params.id, - project: {$ne: null} + project: { $and: [{ $ne: null }, { $exists: 'project' }] } }; var starredOnly = false;