   listUsers: (userId) ->
     if userId?
       query = _id: ObjectID(userId)
-    find = Q.nbind(User.find, User)
-    find(query)
+    Q(User.find(query).exec())
 
   listCompetitionsByOwner: (ownerId) ->
     if not userId?

    throw "must provide db connection" unless @db

  createUser: (name) ->
    create = Q.nbind(User.create, User)
    create(name: name)
    .then (val) ->
      bus.emit('user:created', val)
      val

      return errPromise

    query = owner_id: ObjectID(userId)
    Q(Competition.find(query).exec())

  listCompetitions: ->
    Q(Competition.find().exec())

  listCompetitionsByMembership: (userId) ->

  startCompetition: (userId, name) ->
    Q(
      Competition.create(
        name: name
        owner_id: userId
        open: true
        type: 'multi'
        participants: [ObjectID(userId)]
      ).exec()
    ).then (competition) ->
      bus.emit('competition:started', competition)
      competition

  endCompetition: (competitionId) ->
    Q(
      Competition.findOneAndUpdate(
        { _id: competitionId },
        { open: false }
      )
    ).then (competition) ->
      bus.emit('competition:ended', competition)
      competition

  voteFor: (userId, competitionId, choiceId) ->
    query =
      user_id: userId
    toUpdate =
      choice_id: choiceId

    Q(Vote.findByIdAndUpdate(query, toUpdate).exec())
    .then (vote) ->
      bus.emit('vote:cast', vote)
      vote
