         else
           res.json 200, obj
   update = (req, res, next) ->
+    req.body.systemId = req.systemId
     if req.params.id
 
       # wierdly, mongoose doesn't work if you put an id

module.exports = (model) ->
  create = (req, res, next) ->
    model.create req.body, (err, obj) ->
      if err
        res.json 500, {error: err.toString()}

      else
        options.query[k] = v

    #Only return date for the system in question
    console.log 'sytemId filtering'
    options.query.systemId = req.systemId

    model.find options
    , (err, result, pageCount) ->
      if err
