         )
 
 
-  findOne: (readAggregateName, query, callback) ->
+  findOne: ([readAggregateName]..., query, callback) ->
+    return unless readAggregateName = @_readAggregateNameNotSet readAggregateName, callback
+
     @find readAggregateName, query, (err, results) =>
       return callback err, null if err
       return callback null, false if results.length == 0


      callback null, aggregateIds


module.exports = ReadAggregateRepository

  constructor: (@_aggregateName, @_eventStore) ->

  findById: ([readAggregateName]..., aggregateId, callback) =>
    return unless readAggregateName = @_readAggregateNameNotSet readAggregateName, callback

    # create the ReadAggregate instance
    ReadAggregateClass = @getClass readAggregateName

    if not ReadAggregateClass
      err = new Error "Tried 'findById' on not registered ReadAggregate '#{readAggregateName}'"
      return callback err, null

    @_eventStore.find @_aggregateName, { 'aggregate.id': aggregateId }, (err, domainEvents) =>
      return callback err, null if err
