     oldDocuments = {}
     documents = {}
 
-    collectionNames = {}
+    allCollectionNames = {}
 
     publish._currentComputation = ->
       if Tracker.active

Fiber = Npm.require 'fibers'

checkNames = (publish, collectionNames, computation, result) ->
  if result and _.isArray result
    resultNames = (cursor._getCollectionName() for cursor in result when _.isObject(cursor) and '_getCollectionName' of cursor)
  else if result and _.isObject(result) and '_getCollectionName' of result

  else
    resultNames = []

  resultNames

checkNames = (publish, allCollectionNames, id, collectionNames) ->
  for computationId, names of allCollectionNames when computationId isnt id
    for collectionName in names when collectionName in collectionNames
      publish.error new Error "Multiple cursors for collection '#{collectionName}'"
      return false

