   if not updateAll and @ instanceof globals.Document._ReferenceField
     index = {}
     index["#{ @sourcePath }._id"] = 1
-    @sourceCollection._ensureIndex index if @sourceCollection._connection is Meteor.server
+    @sourceCollection._ensureIndex index if Meteor.isServer and @sourceCollection._connection is Meteor.server
 
     if @reverseName
       index = {}
       index["#{ @reverseName }._id"] = 1
-      @targetCollection._ensureIndex index if @targetCollection._connection is Meteor.server
+      @targetCollection._ensureIndex index if Meteor.isServer and @targetCollection._connection is Meteor.server
 
   initializing = true
 
   observers =
-    added: globals.Document._observerCallback (id, fields) =>
+    added: globals.Document._observerCallback @targetCollection, (id, fields) =>
       @updateSource id, fields if updateAll or not initializing
 
   unless updateAll
-    observers.changed = globals.Document._observerCallback (id, fields) =>
+    observers.changed = globals.Document._observerCallback @targetCollection, (id, fields) =>
       @updateSource id, fields
 
-    observers.removed = globals.Document._observerCallback (id) =>
+    observers.removed = globals.Document._observerCallback @targetCollection, (id) =>
       @removeSource id
 
   referenceFields = fieldsToProjection @fields


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

    initializing = true

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

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

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

    # 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 (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
