         level: {original: level.original.toString(), majorVersion: level.version.major}
         creator: req.user.id
       }
+
+      sessionQuery.team = req.query.team if req.query.team
+      
       Session.findOne(sessionQuery).exec (err, doc) =>
         return @sendDatabaseError(res, err) if err
         if doc

        initVals = sessionQuery
        initVals.state = {complete:false, scripts:{currentScript:null}} # will not save empty objects
        initVals.permissions = [{target:req.user.id, access:'owner'}, {target:'public', access:'write'}]
        session = new Session(initVals)
        session.save (err) =>
          return @sendDatabaseError(res, err) if err


  getByRelationship: (req, res, args...) ->
    return @getSession(req, res, args[0]) if args[1] is 'session'
    return @getAllSessions(req, res, args[0]) if args[1] is 'all_sessions'
    return @getFeedback(req, res, args[0]) if args[1] is 'feedback'
    return @sendNotFoundError(res)

