       db.devicesCollection.mapReduce(map, reduce, options, (err, out) ->
         for o in out
           alias = config.PARAMETERS[o.value].alias
-          if not aliases[alias]?
-            aliases[alias] = []
+          aliases[alias] ?= []
           id = String(o._id)
           if id not in aliases[alias]
             aliases[alias].push(id)


compileAliases = (callback) ->
  map = () ->
    for key, parts of keys
      ref = this
      path = ''
      for part in parts
        if part.test?
          r = ref
          ref = null
          for p of r
            if part.test(p)
              path += ".#{p}"
              ref = r[p]
              break
        else
          path += ".#{part}"
          ref = ref[part]
        break if not ref
      emit(path[1..], key) if ref
    return

  reduce = (k, v) ->

        if ++counter == batches.length
          callback(err, aliases, config.ALIASES_CACHE)
      )
    return
  )


