     # Setup observers only for local collections or server collection. Collections based
     # on a connection to some other primary collections should not have observers because
     # they should be setup at the location of primary collections, not here.
-    for document in @list when document.Meta.collection._connection in [null, Meteor.server]
+    for document in @list when (Meteor.isClient and document.Meta.collection._connection is null) or (Meteor.isServer and document.Meta.collection._connection in [null, Meteor.server])
       if updateAll
         # For fields we pass updateAll on.
         setupTargetObservers document.Meta.fields

  if not updateAll and @ instanceof globals.Document._ReferenceField
    index = {}
    index["#{ @sourcePath }._id"] = 1
    @sourceCollection._ensureIndex index if @sourceCollection._connection is Meteor.server

    if @reverseName
      index = {}
      index["#{ @reverseName }._id"] = 1
      @targetCollection._ensureIndex index if @targetCollection._connection is Meteor.server

  initializing = true

  observers =
    added: globals.Document._observerCallback (id, fields) =>
      @updateSource id, fields if updateAll or not initializing

  unless updateAll
    observers.changed = globals.Document._observerCallback (id, fields) =>
      @updateSource id, fields

    observers.removed = globals.Document._observerCallback (id) =>
      @removeSource id

  referenceFields = fieldsToProjection @fields


    unless updateAll
      for index in indexes
        @Meta.collection._ensureIndex index if Meteor.isServer and @Meta.collection._connection is Meteor.server

    initializing = true

    observers =
      added: globals.Document._observerCallback @Meta.collection, (id, fields) =>
        @_sourceUpdated id, fields if updateAll or not initializing

    unless updateAll
      observers.changed = globals.Document._observerCallback @Meta.collection, (id, fields) =>
        @_sourceUpdated id, fields

    handle = @Meta.collection.find({}, fields: sourceFields).observeChanges observers
