function () { if (count > 0) return this.emit('end'); var status = controller.emptyCollection(); response.status(status); if (status === 204) return this.emit('end'); if (status === 200) { response.json([]); // TODO other content types this.emit('end'); return; } this.emit('error', RestError.NotFound()); }
function () { if (count > 0) return this.emit('end'); this.emit('error', RestError.NotFound()); }
query.exec(function (error, doc) { if (error) return callback(error); if (!doc) return callback(RestError.NotFound()); // Add the Mongoose document to the context. callback(null, { doc: doc, incoming: context.incoming }); });